2014-03-05 167 views
3

我已準備好運行Phonegap,但出現錯誤。也許有人知道如何解決它。試圖在Ubuntu上運行Phonegap 13.04

以下是錯誤:

我打字PhoneGap的運行Android的

[apkbuilder] Creating HelloWorld-debug-unaligned.apk and signing it with a debug key... 

-post-package: 

-do-debug: 
[zipalign] Running zip align on final apk... 
    [echo] Debug Package: /home/almeidamarcell/my-app/platforms/android/ant-build/HelloWorld-debug.apk 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 

-post-build: 
    [move] Moving 1 file to /home/almeidamarcell/my-app/platforms/android/ant-build 
    [move] Moving 1 file to /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build 

debug: 

BUILD SUCCESSFUL 
Total time: 6 seconds 
[phonegap] successfully compiled Android app 
[phonegap] trying to install app onto device 
{ [ReferenceError: a is not defined] 
    stack: 'ReferenceError: a is not defined\n at Object.ConfigParser.getPreference (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/ConfigParser.js:88:23)\n at Object.module.exports.findOrientationPreference (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/metadata/android_parser.js:52:26)\n at Object.module.exports.update_from_config (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/metadata/android_parser.js:84:36)\n at Object.module.exports.update_project (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/metadata/android_parser.js:167:18)\n at /usr/local/lib/node_modules/phonegap/node_modules/cordova/src/prepare.js:113:31\n at _fulfilled (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:798:54)\n at self.promiseDispatch.done (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:827:30)\n at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:760:13)\n at /usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:821:14\n at flush (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:108:17)' } 
Buildfile: /home/almeidamarcell/my-app/platforms/android/build.xml 

-set-mode-check: 

-set-debug-files: 

-check-env: 
[checkenv] Android SDK Tools Revision 22.6.0 
[checkenv] Installed at /opt/android-sdk-linux 

-setup: 
    [echo] Project Name: HelloWorld 
    [gettype] Project Type: Application 

-set-debug-mode: 

-debug-obfuscation-check: 

-pre-build: 

-build-setup: 
[getbuildtools] Using latest Build Tools: 19.0.3 
    [echo] Resolving Build Target for HelloWorld... 
[gettarget] Project Target: Android 4.4.2 
[gettarget] API level:  19 
    [echo] ---------- 
    [echo] Creating output directories if needed... 
    [echo] ---------- 
    [echo] Resolving Dependencies for HelloWorld... 
[dependency] Library dependencies: 
[dependency] 
[dependency] ------------------ 
[dependency] Ordered libraries: 
[dependency] 
[dependency] ------------------ 
    [echo] ---------- 
    [echo] Building Libraries with 'debug'... 

nodeps: 

-set-mode-check: 

-set-debug-files: 

-check-env: 
[checkenv] Android SDK Tools Revision 22.6.0 
[checkenv] Installed at /opt/android-sdk-linux 

-setup: 
    [echo] Project Name: CordovaLib 
    [gettype] Project Type: Android Library 

-set-debug-mode: 

-debug-obfuscation-check: 

-pre-build: 

-build-setup: 
[getbuildtools] Using latest Build Tools: 19.0.3 
    [echo] Resolving Build Target for CordovaLib... 
[gettarget] Project Target: Android 4.4.2 
[gettarget] API level:  19 
    [echo] ---------- 
    [echo] Creating output directories if needed... 
    [echo] ---------- 
    [echo] Resolving Dependencies for CordovaLib... 
[dependency] Library dependencies: 
[dependency] No Libraries 
[dependency] 
[dependency] ------------------ 

-code-gen: 
[mergemanifest] Found Deleted Target File 
[mergemanifest] Merging AndroidManifest files into one. 
[mergemanifest] Manifest merger disabled. Using project manifest only. 
    [echo] Handling aidl files... 
    [aidl] No AIDL files to compile. 
    [echo] ---------- 
    [echo] Handling RenderScript files... 
    [echo] ---------- 
    [echo] Handling Resources... 
    [aapt] Found modified input file 
    [aapt] Generating resource IDs... 
    [echo] ---------- 
    [echo] Handling BuildConfig class... 
[buildconfig] No need to generate new BuildConfig. 

-pre-compile: 

-compile: 
    [echo] Creating library output jar file... 

-post-compile: 

-obfuscate: 

-dex: 
    [echo] Library project: do not convert bytecode... 

-crunch: 
    [crunch] Crunching PNG Files in source dir: /home/almeidamarcell/my-app/platforms/android/CordovaLib/res 
    [crunch] To destination dir: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/res 
    [crunch] Crunched 0 PNG files to update cache 

-package-resources: 
    [echo] Library project: do not package resources... 

-package: 
    [echo] Library project: do not package apk... 

-post-package: 

-do-debug: 
    [echo] Library project: do not create apk... 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/build.prop 

-post-build: 

debug: 

-code-gen: 
[mergemanifest] Found Deleted Target File 
[mergemanifest] Merging AndroidManifest files into one. 
[mergemanifest] Manifest merger disabled. Using project manifest only. 
    [echo] Handling aidl files... 
    [aidl] No AIDL files to compile. 
    [echo] ---------- 
    [echo] Handling RenderScript files... 
    [echo] ---------- 
    [echo] Handling Resources... 
    [aapt] Found modified input file 
    [aapt] Generating resource IDs... 
    [echo] ---------- 
    [echo] Handling BuildConfig class... 
[buildconfig] No need to generate new BuildConfig. 

-pre-compile: 
    [echo] Set jars path to: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/classes.jar 

-compile: 
    [javac] Compiling 1 source file to /home/almeidamarcell/my-app/platforms/android/ant-build/classes 

-post-compile: 

-obfuscate: 

-dex: 
     [dex] input: /home/almeidamarcell/my-app/platforms/android/ant-build/classes 
     [dex] input: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/classes.jar 
     [dex] Using Pre-Dexed classes-a82c7d07d612c222e41d4b5fb4fa6480.jar <- /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/classes.jar 
     [dex] Found modified input file 
     [dex] Converting compiled files and external libraries into /home/almeidamarcell/my-app/platforms/android/ant-build/classes.dex... 
     [dx] Merged dex A (7 defs/2.2KiB) with dex B (205 defs/312.8KiB). Result is 212 defs/383.8KiB. Took 0.3s 

-crunch: 
    [crunch] Crunching PNG Files in source dir: /home/almeidamarcell/my-app/platforms/android/res 
    [crunch] To destination dir: /home/almeidamarcell/my-app/platforms/android/ant-build/res 
    [crunch] Crunched 0 PNG files to update cache 

-package-resources: 
    [aapt] Found modified input file 
    [aapt] Creating full resource package... 

-package: 
[apkbuilder] Found modified input file 
[apkbuilder] Creating HelloWorld-debug-unaligned.apk and signing it with a debug key... 

-post-package: 

-do-debug: 
[zipalign] Running zip align on final apk... 
    [echo] Debug Package: /home/almeidamarcell/my-app/platforms/android/ant-build/HelloWorld-debug.apk 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 

-post-build: 
    [move] Moving 1 file to /home/almeidamarcell/my-app/platforms/android/ant-build 
    [move] Moving 1 file to /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build 

debug: 

BUILD SUCCESSFUL 
Total time: 6 seconds 
WARNING : No started emulators found, starting an emulator. 

/home/almeidamarcell/my-app/platforms/android/cordova/node_modules/q/q.js:126 
        throw e; 
         ^
ERROR : No emulator images (avds) found, if you would like to create an 
avd follow the instructions provided here: 
http://developer.android.com/tools/devices/index.html 
Or run 'android create avd --name <name> --target <targetID>' 
in on the command line. 
[phonegap] no device was found 
[phonegap] trying to install app onto emulator 
{ [ReferenceError: a is not defined] 
    stack: 'ReferenceError: a is not defined\n at Object.ConfigParser.getPreference (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/ConfigParser.js:88:23)\n at Object.module.exports.findOrientationPreference (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/metadata/android_parser.js:52:26)\n at Object.module.exports.update_from_config (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/metadata/android_parser.js:84:36)\n at Object.module.exports.update_project (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/metadata/android_parser.js:167:18)\n at /usr/local/lib/node_modules/phonegap/node_modules/cordova/src/prepare.js:113:31\n at _fulfilled (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:798:54)\n at self.promiseDispatch.done (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:827:30)\n at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:760:13)\n at /usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:821:14\n at flush (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/q/q.js:108:17)' } 
Buildfile: /home/almeidamarcell/my-app/platforms/android/build.xml 

-set-mode-check: 

-set-debug-files: 

-check-env: 
[checkenv] Android SDK Tools Revision 22.6.0 
[checkenv] Installed at /opt/android-sdk-linux 

-setup: 
    [echo] Project Name: HelloWorld 
    [gettype] Project Type: Application 

-set-debug-mode: 

-debug-obfuscation-check: 

-pre-build: 

-build-setup: 
[getbuildtools] Using latest Build Tools: 19.0.3 
    [echo] Resolving Build Target for HelloWorld... 
[gettarget] Project Target: Android 4.4.2 
[gettarget] API level:  19 
    [echo] ---------- 
    [echo] Creating output directories if needed... 
    [echo] ---------- 
    [echo] Resolving Dependencies for HelloWorld... 
[dependency] Library dependencies: 
[dependency] 
[dependency] ------------------ 
[dependency] Ordered libraries: 
[dependency] 
[dependency] ------------------ 
    [echo] ---------- 
    [echo] Building Libraries with 'debug'... 

nodeps: 

-set-mode-check: 

-set-debug-files: 

-check-env: 
[checkenv] Android SDK Tools Revision 22.6.0 
[checkenv] Installed at /opt/android-sdk-linux 

-setup: 
    [echo] Project Name: CordovaLib 
    [gettype] Project Type: Android Library 

-set-debug-mode: 

-debug-obfuscation-check: 

-pre-build: 

-build-setup: 
[getbuildtools] Using latest Build Tools: 19.0.3 
    [echo] Resolving Build Target for CordovaLib... 
[gettarget] Project Target: Android 4.4.2 
[gettarget] API level:  19 
    [echo] ---------- 
    [echo] Creating output directories if needed... 
    [echo] ---------- 
    [echo] Resolving Dependencies for CordovaLib... 
[dependency] Library dependencies: 
[dependency] No Libraries 
[dependency] 
[dependency] ------------------ 

-code-gen: 
[mergemanifest] Found Deleted Target File 
[mergemanifest] Merging AndroidManifest files into one. 
[mergemanifest] Manifest merger disabled. Using project manifest only. 
    [echo] Handling aidl files... 
    [aidl] No AIDL files to compile. 
    [echo] ---------- 
    [echo] Handling RenderScript files... 
    [echo] ---------- 
    [echo] Handling Resources... 
    [aapt] Found modified input file 
    [aapt] Generating resource IDs... 
    [echo] ---------- 
    [echo] Handling BuildConfig class... 
[buildconfig] No need to generate new BuildConfig. 

-pre-compile: 

-compile: 
    [echo] Creating library output jar file... 

-post-compile: 

-obfuscate: 

-dex: 
    [echo] Library project: do not convert bytecode... 

-crunch: 
    [crunch] Crunching PNG Files in source dir: /home/almeidamarcell/my-app/platforms/android/CordovaLib/res 
    [crunch] To destination dir: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/res 
    [crunch] Crunched 0 PNG files to update cache 

-package-resources: 
    [echo] Library project: do not package resources... 

-package: 
    [echo] Library project: do not package apk... 

-post-package: 

-do-debug: 
    [echo] Library project: do not create apk... 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/build.prop 

-post-build: 

debug: 

-code-gen: 
[mergemanifest] Found Deleted Target File 
[mergemanifest] Merging AndroidManifest files into one. 
[mergemanifest] Manifest merger disabled. Using project manifest only. 
    [echo] Handling aidl files... 
    [aidl] No AIDL files to compile. 
    [echo] ---------- 
    [echo] Handling RenderScript files... 
    [echo] ---------- 
    [echo] Handling Resources... 
    [aapt] Found modified input file 
    [aapt] Generating resource IDs... 
    [echo] ---------- 
    [echo] Handling BuildConfig class... 
[buildconfig] No need to generate new BuildConfig. 

-pre-compile: 
    [echo] Set jars path to: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/classes.jar 

-compile: 
    [javac] Compiling 1 source file to /home/almeidamarcell/my-app/platforms/android/ant-build/classes 

-post-compile: 

-obfuscate: 

-dex: 
     [dex] input: /home/almeidamarcell/my-app/platforms/android/ant-build/classes 
     [dex] input: /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/classes.jar 
     [dex] Using Pre-Dexed classes-a82c7d07d612c222e41d4b5fb4fa6480.jar <- /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build/classes.jar 
     [dex] Found modified input file 
     [dex] Converting compiled files and external libraries into /home/almeidamarcell/my-app/platforms/android/ant-build/classes.dex... 
     [dx] Merged dex A (7 defs/2.2KiB) with dex B (205 defs/312.8KiB). Result is 212 defs/383.8KiB. Took 0.3s 

-crunch: 
    [crunch] Crunching PNG Files in source dir: /home/almeidamarcell/my-app/platforms/android/res 
    [crunch] To destination dir: /home/almeidamarcell/my-app/platforms/android/ant-build/res 
    [crunch] Crunched 0 PNG files to update cache 

-package-resources: 
    [aapt] Found modified input file 
    [aapt] Creating full resource package... 

-package: 
[apkbuilder] Found modified input file 
[apkbuilder] Creating HelloWorld-debug-unaligned.apk and signing it with a debug key... 

-post-package: 

-do-debug: 
[zipalign] Running zip align on final apk... 
    [echo] Debug Package: /home/almeidamarcell/my-app/platforms/android/ant-build/HelloWorld-debug.apk 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 
[propertyfile] Updating property file: /home/almeidamarcell/my-app/platforms/android/ant-build/build.prop 

-post-build: 
    [move] Moving 1 file to /home/almeidamarcell/my-app/platforms/android/ant-build 
    [move] Moving 1 file to /home/almeidamarcell/my-app/platforms/android/CordovaLib/ant-build 

debug: 

BUILD SUCCESSFUL 
Total time: 6 seconds 

/home/almeidamarcell/my-app/platforms/android/cordova/node_modules/q/q.js:126 
        throw e; 
         ^
ERROR : No emulator images (avds) found, if you would like to create an 
avd follow the instructions provided here: 
http://developer.android.com/tools/devices/index.html 
Or run 'android create avd --name <name> --target <targetID>' 
in on the command line. 
    [error] /home/almeidamarcell/my-app/platforms/android/cordova/run: Command failed with exit code 1 
[email protected]:~/my-app$ 

後的NodeJS得到這個錯誤 - 五:v0.10.26

節點-v: v0.11.12-pre

NPM -v:1.4.3

的PhoneGap -v:3.4.0-0.19.7

科爾多瓦-v:3.4.0-0.1.0

螞蟻-v:編譯於2013年7月14日的Apache Ant(TM)1.9.2版 嘗試使用默認構建文件:build.xml Buildfile:build.xml不存在!構建失敗

的Ubuntu 13.04

我也已經安裝了Java和Android SDK。

回答

5

您可以在命令行上運行「android」並使用GUI選擇「管理AVD ...」。從那裏創建一個AVD,你很好走。

重要提示:AVD僅對創建它的用戶可見,我必須運行「sudo phonegap」並嘗試創建一個沒有sudo的avd,並且它對phonegap不可見。所以我必須「sudo android」並重新創建它。

http://developer.android.com/tools/devices/index.html

+0

+1針對具有不同用戶的AVD的可見度+1 – Goaler444