我正在尝试运行基本的hello-world应用程序。我完全沮丧无法找到解决方案。怎么了?我试过these solutions但仍然没有运气。请帮帮我:'(
C:\apps>phonegap create app3 [phonegap] create called with the options C:\apps\app3 com.phonegap.helloworld HelloWorld [phonegap] Customizing default config.xml file [phonegap] created project at C:\apps\app3 C:\apps>cd app3 C:\apps\app3>phonegap local run android [phonegap] adding the Android platform... Creating Cordova project for the Android platform: Path: platforms\android Package: com.phonegap.helloworld Name: HelloWorld Android target: android-19 Copying template files... Running: android update project --subprojects --path "platforms\android" --target android-19 --library "CordovaLib" Resolved location of library project to: C:\apps\app3\platforms\android\CordovaLib Updated and renamed default.properties to project.properties Updated local.properties No project name specified, using Activity name 'HelloWorld'. If you wish to change it, edit the first line of build.xml. Added file C:\apps\app3\platforms\android\build.xml Added file C:\apps\app3\platforms\android\proguard-project.txt Updated project.properties Updated local.properties No project name specified, using project folder name 'CordovaLib'. If you wish to change it, edit the first line of build.xml. Added file C:\apps\app3\platforms\android\CordovaLib\build.xml Added file C:\apps\app3\platforms\android\CordovaLib\proguard-project.txt Project successfully created. cp: no such file or directory: C:\apps\app3\icon.png cp: no such file or directory: C:\apps\app3\res\icon\ios\icon-72.png [phonegap] compiling Android... cp: no such file or directory: C:\apps\app3\icon.png cp: no such file or directory: C:\apps\app3\res\icon\ios\icon-72.png Buildfile: C:\apps\app3\platforms\android\build.xml [taskdef] Could not load definitions from resource emma_ant.properties. It could not be found. -set-mode-check: -set-debug-files: -check-env: [checkenv] Android SDK Tools Revision 23.0.0 [checkenv] Installed at F:\Android\SDK-for-kepler\sdk -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.1.0 [echo] Resolving Build Target for HelloWorld... [gettarget] Project Target: Android 4.4.2 [gettarget] API level: 19 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: C:\apps\app3\platforms\android\ant-build [mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\res [mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\rsObj [mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\rsLibs [mkdir] Created dir: C:\apps\app3\platforms\android\ant-gen [mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\classes [mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\dexedLibs [echo] ---------- [echo] Resolving Dependencies for HelloWorld... [dependency] Library dependencies: [dependency] [dependency] ------------------ [dependency] Ordered libraries: [dependency] [dependency] ------------------ [echo] ---------- [echo] Building Libraries with 'debug'... [taskdef] Could not load definitions from resource emma_ant.properties. It could not be found. nodeps: -set-mode-check: -set-debug-files: -check-env: [checkenv] Android SDK Tools Revision 23.0.0 [checkenv] Installed at F:\Android\SDK-for-kepler\sdk -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.1.0 [echo] Resolving Build Target for CordovaLib... [gettarget] Project Target: Android 4.4.2 [gettarget] API level: 19 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\res [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\libs [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\res [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\rsObj [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\rsLibs [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-gen [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\classes [mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\dexedLibs [echo] ---------- [echo] Resolving Dependencies for CordovaLib... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------ -code-gen: [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] Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] Generating BuildConfig class. -pre-compile: -compile: [javac] Compiling 90 source files to C:\apps\app3\platforms\android\CordovaLib\ant-build\classes [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [echo] Creating library output jar file... [jar] Building jar: C:\apps\app3\platforms\android\CordovaLib\ant-build\classes.jar -post-compile: -obfuscate: -dex: [echo] Library project: do not convert bytecode... -crunch: [crunch] Crunching PNG Files in source dir: C:\apps\app3\platforms\android\CordovaLib\res [crunch] To destination dir: C:\apps\app3\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] Creating new property file: C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop [propertyfile] Updating property file: C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop [propertyfile] Updating property file: C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop [propertyfile] Updating property file: C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop -post-build: debug: -code-gen: [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] Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] Generating BuildConfig class. -pre-compile: [echo] Set jars path to: C:\apps\app3\platforms\android\CordovaLib\ant-build\classes.jar -compile: [javac] Compiling 3 source files to C:\apps\app3\platforms\android\ant-build\classes -post-compile: -obfuscate: -dex: [dex] input: C:\apps\app3\platforms\android\ant-build\classes [dex] input: C:\apps\app3\platforms\android\CordovaLib\ant-build\classes.jar [dex] Pre-Dexing C:\apps\app3\platforms\android\CordovaLib\ant-build\classes.jar -> classes-b6d5849ba546b3720c0e46effd6702fc.jar [dx] Error occurred during initialization of VM [dx] Could not reserve enough space for object heap [dx] Could not create the Java virtual machine. BUILD FAILED F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:892: The following error occurred while executing this line: F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:894: The following error occurred while executing this line: F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:906: The following error occurred while executing this line: F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:283: null returned: 1 Total time: 4 seconds Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\apps\app3\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen { [Error: C:\apps\app3\platforms\android\cordova\build.bat: Command failed with exit code 2] code: 2 } [error] C:\apps\app3\platforms\android\cordova\build.bat: Command failed with exit code 2
答案 0 :(得分:5)
这对我有用
转到开始 - >控制面板 - >系统 - >高级(标签) - >环境变量 - >系统变量 - >新增功能:
变量名称:_JAVA_OPTIONS
变量值:-Xmx512M
答案 1 :(得分:2)
答案 2 :(得分:0)
您的logcat输出清楚地表明应用程序构建失败,因为sdk工具问题。在环境变量中添加sdk工具的路径,例如yourpath\sdk\platform-tools\;'your path'\sdk\tools\
。确保以这种方式添加路径转到advancedsystemsettings-> Enviromentvariables-> systemvariables(不是用户变量)选择{{1}系统变量并添加路径
答案 3 :(得分:0)
以下是修复方法:
转到 开始 - >控制面板 - >系统 - >高级(标签) - >环境变量 - >系统
Variables->New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Variable name: Path
Variable value: ;C:\Program Files\Java\jre6\bin;F:\JDK\bin;
Change this to your appropriate path.