Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Master, 2.9.0, 3.0.0
-
Mac OSX 10.7.5
cordova version 2.9.5
android sdk tools 22.0.1
android sdk platform-tools 17
android sdk built-tools 17
android 4.2.2 (API 17)
Description
Was following the cordova command line tutorial, as part of the PhoneGap overview, found here:
http://docs.phonegap.com/en/2.9.0/guide_cli_index.md.html#The%20Cordova%20Command-line%20Interface
When I tried to execute the step to add the android platform, e.g.
cordova platform add android
I received the error,
An unexpected error occurred: "$ANDROID_BIN" create project --target 1 --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY >&/dev/null exited with 1
Deleting project...
I then ran the command in debug mode to get more details, e.g.
cordova -d platform add android
and received the output,
cordova library for "android" already exists. No need to download. Continuing.
Checking if platform "android" passes minimum requirements...
Checking Android requirements...
Running "android list target" (output to follow)
Available Android targets:
----------
id: 1 or "android-17"
Name: Android 4.2.2
Type: Platform
API level: 17
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
ABIs : armeabi-v7a, mips, x86
----------
id: 2 or "Google Inc.:Google APIs:17"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 3
Description: Android + Google APIs
Based on Android 4.2.2 (API level 17)
Libraries:
- com.google.android.media.effects (effects.jar)
Collection of video effects - com.android.future.usb.accessory (usb.jar)
API for USB Accessories - com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA854, WQVGA400, WSVGA, WXGA800-7in, WXGA720, HVGA, WQVGA432, WVGA800 (default), QVGA, WXGA800
ABIs : armeabi-v7a
Running "android update project -p "/Users/gsnyder/.cordova/lib/android/cordova/2.9.0/framework" -t android-17" (output to follow)...
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Updated file /Users/gsnyder/.cordova/lib/android/cordova/2.9.0/framework/proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
Running bin/create for platform "android" with command: ""/Users/gsnyder/.cordova/lib/android/cordova/2.9.0/bin/create" "/Users/gsnyder/projects/HelloWorld/platforms/android" "com.example.hello" "Hello World"" (output to follow)
TARGET: 2; PROJECT_PATH: /Users/gsnyder/projects/HelloWorld/platforms/android; PACKAGE: com.example.hello; ACTIVITY: Hello World
An unexpected error occurred: "$ANDROID_BIN" create project --target 1 --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY >&/dev/null exited with 1
Deleting project...
Error: An error occured during creation of android sub-project.
An unexpected error occurred: "$ANDROID_BIN" create project --target 1 --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY >&/dev/null exited with 1
Deleting project...
at /usr/local/lib/node_modules/cordova/src/platform.js:231:35
at /usr/local/lib/node_modules/cordova/node_modules/shelljs/shell.js:1707:7
at ChildProcess.exithandler (child_process.js:636:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:730:16)
at Process.ChildProcess._handle.onexit (child_process.js:797:5)
I modified the "create" script to show what the values were for TARGET, PROJECT_PATH, PACKAGE, and ACTIVITY. I then began experimenting with running the "android create project" command directly and found that the use of a space in the ACTIVITY parameter was causing the command to fail. After removing the space from the ACTIVITY parameter the command completed successfully. Here's the command I used, e.g.
android create project --target 2 --path /Users/gsnyder/projects/HelloWorld/platforms/android --package com.example.hello --activity "HelloWorld"
and the output I received,
Created project directory: /Users/gsnyder/projects/HelloWorld/platforms/android
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/src/com/example/hello
Added file /Users/gsnyder/projects/HelloWorld/platforms/android/src/com/example/hello/HelloWorld.java
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/res
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/bin
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/libs
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/res/values
Added file /Users/gsnyder/projects/HelloWorld/platforms/android/res/values/strings.xml
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/res/layout
Added file /Users/gsnyder/projects/HelloWorld/platforms/android/res/layout/main.xml
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/res/drawable-xhdpi
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/res/drawable-hdpi
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/res/drawable-mdpi
Created directory /Users/gsnyder/projects/HelloWorld/platforms/android/res/drawable-ldpi
Added file /Users/gsnyder/projects/HelloWorld/platforms/android/AndroidManifest.xml
Added file /Users/gsnyder/projects/HelloWorld/platforms/android/build.xml
Added file /Users/gsnyder/projects/HelloWorld/platforms/android/proguard-project.txt
Does this mean that the tutorial should be using a space in the creation of the project? Or, does this mean that the "create" script which issues the platform creation command is taking the ACTIVITY parameter from the wrong place?