Reputation: 95
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!
Upvotes: 5
Views: 990
Reputation: 1768
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
Upvotes: 1
Reputation: 11
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>
$ /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
Upvotes: 1
Reputation: 95
The problem was that I did not included any dot in the package name.
Thanks for the replies!
Upvotes: 1
Reputation:
i had this problem, because i used a dash...
instead of com.my-company.myapp, i had to use com.mycompany.myapp
Upvotes: 5
Reputation: 11
I think it is a problem with perms... do you test it with other user?? root user??
Upvotes: 1
Reputation: 1453
type the following .\create "\home\myusername\projects" "com.mycompanyname.myfirstapp" "MyFirstrApp"
I am on windows so my backslash is your slash.
Upvotes: 1