我遇到Phonegap問題。當我想用下面的命令添加了平臺的錯誤:Phonegap平臺添加android
$ export PATH=${PATH}:/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/platform-tools:/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/tools
$ cordova create hello com.example.hello "HelloWorld"
Creating a new cordova project with name "HelloWorld" and id "com.example.hello" at location "/home/matjazmav/hello"
$ cd hello
/hello$ cordova platform add android
Creating android project...
/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at /home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29
at _rejected (/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
at /home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
at Promise.when (/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
at /home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
at flush (/home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: /home/matjazmav/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
hello$
- Ubuntu的LTS 12.04,
- 的PhoneGap 3.4.0-0.19.18,
- 科爾多瓦3.4.1-0.1.0,
Node.js的,
{http_parser: '1.0', 節點: '0.10.26', V8: '3.14.5.9', 頃: '1.9.0-DEV', UV: '0.10.25', ZLIB: '1.2.3', 模塊: '11', OpenSSL的: '1.0.1e', NPM: '1.4.3'}
和PATH設置爲
$ echo $ PATH /usr/lib/lightdm/lightdm:/ usr/local/sbin:/ usr/local/bin:/ usr/sbin:/ usr/bin:/ sbin:/ bin:/usr/games:/ ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/platform-tools:/ ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/tools $
編輯: 這裏是我的劇本,我又增加了ANT,JAVA和Android到PATH:
#!/bin/bash
clear
export PATH=${PATH}:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/platform-tools:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/tools:/usr/lib/jvm/java-6-openjdk-amd64/bin:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/:/usr/bin/ant/
echo "$PATH"
phonegap create $1 $2 $3
cd ./$1
# phonegap platform add android # [error]
phonegap build android
這裏是輸出(更新的最後兩行前):
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/platform-tools:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/tools:/usr/lib/jvm/java-6-openjdk-amd64/bin:/home/matjazmav/ProgramFiles/Android/adt-bundle-linux-x86_64-20140321/sdk/:/usr/bin/ant/
[phonegap] the options /home/matjazmav/hello com.example.hello HelloWorld
[phonegap] created project at /home/matjazmav/hello
[error] 'platform add android' is not a node /usr/bin/phonegap command. See 'node /usr/bin/phonegap help'
謝謝!