Phonegap运行android给出错误 [英] Phonegap run android gives error

查看:148
本文介绍了Phonegap运行android给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行基本的hello-world应用程序。我完全感到沮丧,找不到解决办法。哪里不对?我尝试过这些解决方案,但仍然没有运气。请帮助我:'(

 

C:\apps> phonegap create app3
[phonegap] create called与选项C:\apps\app3 com.phonegap.helloworld HelloWorld
[phonegap]自定义默认config.xml文件
[phonegap]创建项目在C:\apps\app3

C:\apps> cd app3

C:\apps\app3> phonegap本地运行android
[phonegap]添加Android平台...
为Android平台创建Cordova项目:
路径:platforms \android
软件包:com.phonegap.helloworld
名称:HelloWorld
Android目标:android-19
复制模板文件...
运行:android更新项目--subprojects --pathplatforms\android--target android-19 --libraryCordovaLib
库的位置项目:C:\apps\app3\platforms\android\CordovaLib
将default.properties更新并重命名为project.properties
更新local.properties
未指定项目名称,使用活动名称'HelloWorld'。
如果要更改它,请编辑build.xml的第一行。
添加文件C:\apps\app3\platforms\android\build.xml
添加文件C:\apps\app3\platforms\android\proguard-project .txt
更新的project.properties
更新的local.properties
未指定项目名称,使用项目文件夹名称'CordovaLib'。
如果要更改它,请编辑build.xml的第一行。
已添加文件C:\apps\app3\platforms\android\CordovaLib\build.xml
已添加文件C:\apps\app3\platforms\android\ CordovaLib \proguard-project.txt

项目已成功创建。
cp:没有这样的文件或目录:C:\apps\app3\icon.png

cp:没有这样的文件或目录:C:\apps\app3\\ \\ res \icon \ios\icon-72.png

[phonegap]编译Android ...
cp:没有这样的文件或目录:C:\apps\ app3\icon.png

cp:没有此类文件或目录:C:\apps\app3\res\icon\ios\icon- 72.png

构建文件:C:\apps\app3\platforms\android\build.xml
[taskdef]无法从资源emma_ant.properties加载定义。找不到它。

-set-mode-check:

-set-debug-files:

-check-env:
[checkenv] Android SDK工具修订版23.0.0
[checkenv]安装在F:\Android\SDK-for-kepler \sdk

-setup:
[echo]名称:HelloWorld
[gettype]项目类型:应用程序

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools]使用最新的Build Tools:19.1.0
[echo]解析HelloWorld的构建目标...
[gettarget]项目目标:Android 4.4.2
[gettarget] API级别:19
[echo] ----------
[echo]输出目录...
[mkdir]创建dir:C:\apps\app3\platforms\android\ant-build
[mkdir]创建目录:C:\ apps\app3\platforms\android\ant-build\res
[mkdir]创建目录:C:\apps\app3\platforms\android\ant-build\rsObj
[mkdir]创建目录:C:\apps\app3\platforms\android\ant-build\rsLibs
[mkdir]创建目录:C:\apps\app3 \platforms\android\ant-gen
[mkdir]创建目录:C:\apps\app3\platforms\android\ant-build\classes
[mkdir]创建dir:C:\apps\app3\platforms\android\ant-build\dexedLibs
[echo] ----------
[echo]解析HelloWorld的依赖关系...
[dependency]库依赖关系:
[dependency]
[dependency] ------------------
[dependency]有序库:
[dependency]
[dependency] ------------------
[echo] --- -------
[echo]使用'debug'构建库
[taskdef]无法从资源emma_ant.properties加载定义。找不到它。

nodeps:

-set-mode-check:

-set-debug-files:

-check -env:
[checkenv] Android SDK工具修订版23.0.0
[checkenv]安装在F:\Android\SDK-for-kepler \sdk

- 设置:
[echo]项目名称:CordovaLib
[gettype]项目类型:Android库

-set-debug-mode:

-debug -obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools]使用最新的Build Tools:19.1.0
[echo]解决构建目标为CordovaLib ...
[gettarget]项目目标:Android 4.4.2
[gettarget] API级别:19
[echo] ---
[echo]如果需要创建输出目录...
[mkdir]创建目录:C:\apps\app3\platforms\android\CordovaLib\res
[mkdir]创建目录:C:\apps\app3\platforms\android\CordovaLib\libs
[mkdir]创建目录:C:\apps\app3\platforms\\ \\android \CordovaLib\ant-build
[mkdir]创建目录:C:\apps\app3\platforms\android\CordovaLib\ant-build\res
[ mkdir]创建目录:C:\apps\app3\platforms\android\CordovaLib\ant-build\rsObj
[mkdir]创建目录:C:\apps\app3\ platforms \android\CordovaLib\ant-build\rsLibs
[mkdir]创建目录:C:\apps\app3\platforms\android\CordovaLib\ant-gen
[mkdir]创建目录:C:\apps\app3\platforms\android\CordovaLib\ant-build\classes
[mkdir]创建目录:C:\apps\app3 \platforms\android\CordovaLib\ant-build\dexedLibs
[echo] ----------
[echo]解析CordovaLib的依赖关系...
[dependency]库依赖:
[dependency]没有库
[dependency]
[dependency] ------------------

-code-gen:
[mergemanifest]将AndroidManifest文件合并为一个文件。
[mergemanifest]清单合并禁用。仅使用项目清单。
[echo]处理aidl文件...
[aidl]没有要编译的AIDL文件。
[echo] ----------
[echo]处理RenderScript文件...
[echo] ----------
[echo]处理资源...
[aapt]生成资源ID ...
[echo] ----------
[echo]处理BuildConfig类。 ..
[buildconfig]生成BuildConfig类。

-pre-compile:

-compile:
[javac]将90个源文件编译为C:\apps\app3\platforms\android \CordovaLib\ant-build\classes
[javac]注意:某些输入文件使用或覆盖已弃用的API。
[javac]注意:有关详细信息,请使用-Xlint:deprecation重新编译。
[echo]创建库输出jar文件...
[jar]构建jar:C:\apps\app3\platforms\android\CordovaLib\ant-build\classes .jar

-post-compile:

-obfuscate:

-dex:
[echo]库项目:do not convert bytecode ...

-crunch:
[crunch]源代码中的Crunch PNG文件dir:C:\apps\app3\platforms\android\CordovaLib\res
[crunch]到目标目录:C:\apps\app3\platforms\android\CordovaLib\ant-build\res
[crunch]碾碎的0个PNG文件以更新缓存

-package-resources:
[echo]库项目:不打包资源...

-package:
[echo]不封装apk ...

-post-package:

-do-debug:
[echo]库项目:不要创建apk ...
[propertyfile]创建新的属性文件:C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile]更新属性文件: C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile]更新属性文件:C:\apps\app3\platforms\\ \\android\CordovaLib\ant-build\build.prop
[propertyfile]更新属性文件:C:\apps\app3\platforms\android\CordovaLib\ant-build\ build.prop

-post-build:

debug:

-code-gen:
[mergemanifest]将AndroidManifest文件合并到一。
[mergemanifest]清单合并禁用。仅使用项目清单。
[echo]处理aidl文件...
[aidl]没有要编译的AIDL文件。
[echo] ----------
[echo]处理RenderScript文件...
[echo] ----------
[echo]处理资源...
[aapt]生成资源ID ...
[echo] ----------
[echo]处理BuildConfig类。 ..
[buildconfig]生成BuildConfig类。

-pre-compile:
[echo]将jars路径设置为:C:\apps\app3\platforms\android\CordovaLib\ant-build\classes .jar

-compile:
[javac]将3个源文件编译为C:\apps\app3\platforms\android\ant-build\classes

-post-compile:

-obfuscate:

-dex:
[dex]输入:C:\apps\app3\\ \\platforms\android\ant-build\classes
[dex]输入: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] VM初始化期间发生错误
[dx]无法为对象堆预留足够的空间
[dx]无法创建Java虚拟机。

BUILD FAILED
F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:892:执行此操作时出现以下错误line:
F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:894:执行此行时发生以下错误:
F: \Android\SDK-for-kepler\sdk\tools\ant\build.xml:906:执行此行时发生以下错误:
F:\Android\SDK-for -kepler \sdk\tools\ant\build.xml:283:null返回:1

总时间:4秒
命令的错误代码1:cmd with args: /s,/c,ant,debug,-f,C:\apps\app3\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant -gen
{[错误:C:\apps\app3\platforms\android\cordova\build.bat:命令失败,退出代码2]代码:2}
[错误] C:\apps\app3\platforms\android\cordova\build.bat:退出代码为2的命令失败


<看到你的日志后,似乎是java堆内存问题..
看到这个问题更多的帮助..它建议使用64位JDK。 / p>

链接也可能会帮助你。


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

解决方案

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..

这篇关于Phonegap运行android给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆