Tejas Tejas - 15 days ago 4
Android Question

Phonegap run android gives error

I am trying to run the basic hello-world app. I am totally frustrated can't find solution to this. What is wrong? I have tried these solutions but still no luck. Please help me :'(



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


Aks Aks
Answer

After seeing your log it seems to be java heap memory issue.. See this question for more help.. it suggests to use 64-bit JDK.

This link might also help you..