Pages

Friday, 10 May 2013

An unexpected error occurred: "$ANDROID_BIN"




A picture is worth a thousand words, this meme correctly depects how I am feeling right now.
While creating a new project via phonegap ( cordova they call it these days, silly name if you ask me )
, this error message would pop up, and its been like that for more than a day.

./create foo foo foo
An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY &>/dev/null exited with 1
Deleting project...


And I was under the impression that there was something wrong with the path variable that I added in my .bashrc .And i edited it like a thousand times.
 But just 5 minutes ago I found out the real problem.
Apparently package name should be prefixed accordingly with 3 namespace, so foo is not a valid package name. A valid package name looks like this

com.something.something

Now

./create foo com.android.foo foo

works just fine.

If doing this doesn't solve your error then there must be some problem with the path variable you set up, here is what mine looks like

export PATH=${PATH}:$HOME/android-sdk-linux/platform-tools:$HOME/android-sdk-linux/tools

or even this will do fine


export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools



3 comments:

Rodrigo Coutinho said...

hahah after hours stucked with this freaking error, it does not give us a decent error message and tells that path is not set.

Saurav Tomar said...

I'm glad I could help.

André Ricardo said...

Had the same issue:

$ ./create ~/workspace/Test2 package2 Test2
An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY >&/dev/null exited with 1
Deleting project...
andre:bin andre$ ./create ~/workspace/Test2 com.package2.test Test2
$

thanks for posting the solution