5

I've the following error trying to create the project in PhoneGap 2.5.0 for Android:

An unexpected error occurred: 

"$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY >&/dev/null exited with 1

I've no idea of how to fix it. This PhoneGap tutorial

Thank you!

6 Answers 6

5

i had this problem, because i used a dash...

instead of com.my-company.myapp, i had to use com.mycompany.myapp

0
1
  1. hard to know what your problem is without seeing your command line. if you share it, as well as your current directory, it will be easier to help. Saying that, below is my rephrasing onf pg instructions
  2. choose the name to your app. e.g. MyFirstApp
  3. choose names to your package . package is named after company and app, e.g. com.mycompanyname.myfirstapp
  4. decide where you want code to be generated. e.g. \home\myusername\projects
  5. make sure folder exists
  6. go to your phonegap folder, then to lib, then to android then to bin
  7. type the following .\create "\home\myusername\projects" "com.mycompanyname.myfirstapp" "MyFirstrApp"

  8. I am on windows so my backslash is your slash.

  9. good luck
1

I think it is a problem with perms... do you test it with other user?? root user??

  1. test with other user
  2. test folder perms
  3. test user perms
  4. good luck
1

The problem was that I did not included any dot in the package name.

Thanks for the replies!

1

I had to put in a project folder path (see /path/to/my_new_cordova_project below), otherwise I got the error--package name and project name was not enough. Also it couldn't contain hyphens...

./create <project_folder_path> <package_name> <project_name>

http://docs.phonegap.com/en/2.2.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android

$ /path/to/cordova-android/bin/create /path/to/my_new_cordova_project com.example.cordova_project_name CordovaProjectName

from: http://cordova.apache.org/docs/en/2.7.0/guide_command-line_index.md.html

1

I had this same issue while attempting to follow the Cordova CLI tutorial, but the cause in my case was different. It was due to use of a space in one of the parameters used to create the project (see the CLI tutorial).

I was able to see the issue by running the android command directly as suggested by others here, e.g.

android create project --target 2 --path my-proj-path/platforms/android --package com.example.hello --activity Hello World

Note the lack of quotes around "Hello World" which results in an error from the shell.

Once I corrected for that by surrounding it with quotes I got the error,

Error: Activity name 'Hello World' contains invalid characters.

Allowed characters are: a-z A-Z 0-9 _

I then modified my command to remove the space from the activity, e.g.

android create project --target 2 --path my-proj-path/platforms/android --package com.example.hello --activity "HelloWorld"

and the command worked. Not sure about other downstream effects but at least the "create platform" command completed successfully.

My interpretation of this situation is that the PhoneGap API Documentation needs updating or there is a defect in the cordova create script where the ACTIVITY parameter is being taken from the wrong place? I submitted an issue report to the cordova project since I couldn't find another issue there with the same symptoms - see https://issues.apache.org/jira/browse/CB-4198

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.