根据我的环境说明一下:
1、Cordova的目录:/Users/kevin/Projects/HTML5/cordova-2.4.0/cordova-android
2、AndroidSDK目录: /Users/kevin/TBB/adt-bundle-mac-x86_64/sdk
3、设置方法:
(1)Terminal: 定位到Cordova的目录。
cd /Users/kevin/Projects/HTML5/cordova-2.4.0/cordova-android
(2)设置环境变量
export PATH=/Users/kevin/TBB/adt-bundle-mac-x86_64/sdk:/Users/kevin/TBB/adt-bundle-mac-x86_64/sdk/tools/:$PATH
(3)执行 ./bin/create ~/Desktop/myapp com.myapp.special MyApp
特殊说明:
./bin/create /Users/kevin/CordovaProjects/Android/ChunMiaoPu com_chunmiaopu_android chunMiaoPuAndroid
会出现错误:
An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY >&/dev/null exited with 1
Deleting project...
只有执行如下才可以:./bin/create ~/CordovaProjects/Android/ChunMiaoPu com.chunmiaopu.android chunMiaoPuAndroid
~/MyWorkSpace/JiffAndroidApp 会自动创建JiffAndroidApp目录
devmatoMacBook-2:cordova-android kevin$ ./bin/create ~/MyWorkSpace/JiffAndroidApp me.jiff.AndroidApp JiffAndroidApp
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Deleting project...
devmatoMacBook-2:cordova-android kevin$ export PATH=/Applications/eclipseForADT-20130219/sdk:/Applications/eclipseForADT-20130219/sdk/tools/:$PATH
devmatoMacBook-2:cordova-android kevin$ ./bin/create ~/MyWorkSpace/JiffAndroidApp me.jiff.AndroidApp JiffAndroidApp
devmatoMacBook-2:cordova-android kevin$