这是我在这个非常有用的网站上的第一篇文章!
在Google搜索并发现非常有用的自动搜索功能30分钟后,当您输入问题的名称时,我认为是时候我终于开了帐户并问了!
好吧,这是我第一次弄脏手,我看到了一个错误直接击中了我的脸,形式为:
我理解一些编码概念,但是我仍然非常新,我想知道这个网站上有帮助的人是怎么回事,谢谢!
clean:
Deleting directory C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin
Deleting directory C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\gen
Creating output directories if needed...
Created dir: C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin
Created dir: C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin\res
Gathering info for AndroidApplication1...
Android SDK Tools Revision 19
Project Target: Google APIs
Vendor: Google Inc.
Platform Version: 2.3.3
API level: 10
------------------
Resolving library dependencies:
No library dependencies.
------------------
API<=15: Adding annotations.jar to the classpath.
------------------
WARNING: No minSdkVersion value set. Application will install on all Android versions.
Created dir: C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\gen
Created dir: C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin\classes
----------
Handling aidl files...
No AIDL files to compile.
----------
Handling RenderScript files...
No RenderScript files to compile.
----------
Handling Resources...
Generating resource IDs...
----------
Handling BuildConfig class...
Generating BuildConfig class.
Compiling 3 source files to C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin\classes
Converting compiled files and external libraries into C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin\classes.dex...
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Error occurred during initialization of VM
Could not reserve enough space for object heap
C:\Program Files\Android\android-sdk\tools\ant\build.xml:818: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\build.xml:820: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\build.xml:832: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\build.xml:278: null returned: 1
BUILD FAILED (total time: 3 seconds)
发生错误的行:
C:\ Program Files \ Android \ android-sdk \ tools \ ant \ build.xml
<!-- Converts this project's .class files into .dex files -->
<target name="-dex" depends="-compile, -post-compile, -obfuscate">
818 <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
<!-- only convert to dalvik bytecode is *not* a library -->
820 <do-only-if-not-library elseText="Library project: do not convert bytecode..." >
<!-- special case for instrumented builds: need to use no-locals and need
to pass in the emma jar. -->
<if condition="${build.is.instrumented}">
<then>
<dex-helper nolocals="true">
<external-libs>
<fileset file="${emma.dir}/emma_device.jar" />
</external-libs>
</dex-helper>
</then>
<else>
832 <dex-helper />
</else>
</if>
</do-only-if-not-library>
</do-only-if-manifest-hasCode>
</target>
<!-- Configurable macro, which allows to pass as parameters output directory,
output dex filename and external libraries to dex (optional) -->
<macrodef name="dex-helper">
<element name="external-libs" optional="yes" />
<attribute name="nolocals" default="false" />
<sequential>
<!-- sets the primary input for dex. If a pre-dex task sets it to
something else this has no effect -->
<property name="out.dex.input.absolute.dir" value="${out.classes.absolute.dir}" />
<!-- set the secondary dx input: the project (and library) jar files
If a pre-dex task sets it to something else this has no effect -->
<if>
<condition>
<isreference refid="out.dex.jar.input.ref" />
</condition>
<else>
<path id="out.dex.jar.input.ref">
<path refid="project.libraries.jars" />
</path>
</else>
</if>
<dex executable="${dx}"
output="${intermediate.dex.file}"
nolocals="@{nolocals}"
278 verbose="${verbose}">
<path path="${out.dex.input.absolute.dir}"/>
<path refid="out.dex.jar.input.ref" />
<external-libs />
</dex>
</sequential>
</macrodef>
答案 0 :(得分:1)
听起来像内存问题?
VM初始化期间发生错误 无法为对象堆保留足够的空间
(emph mine)
答案 1 :(得分:1)
当我尝试运行示例vs-android(https://code.google.com/p/vs-android/)应用程序时,我遇到了完全相同的错误。
经过大量的捣乱后,我实际上并不知道是什么导致它,但我肯定找到了解决方法。
显然由于某种原因,JVM无法初始化,因为它感觉系统中没有足够的内存。解决方法是将JVM设置为使用512MB的堆大小而不是1024MB的默认大小进行初始化。为此,请执行以下操作:
Go to Start->Control Panel->System->Advanced->Environment Variables->System Variables->New:
Variable name: _JAVA_OPTIONS <br>
Variable value: -Xmx512M
这解决了我的错误,虽然我仍然有问题部署到我的设备,但这是一个不同的问题,至少它编译并创建了一个apk - 我可以将其复制到设备上并运行它。