0

我正在尝试在 Unity 中构建一个 android 项目,但收到此错误:

Failed to compile Java code to DEX:
C:\Users\tziuka-pc\Desktop\project teo\Temp/StagingArea> java -Xmx1024M -Djava.ext.dirs="C:/Users/tziuka-pc/Desktop/dev2/android-sdk-windows\platform-tools/lib/" -jar "C:/Users/tziuka-pc/Desktop/dev2/android-sdk-windows\platform-tools/lib/dx.jar" --dex --verbose --output=bin/classes.dex bin/classes.jar plugins
Error: Unable to access jarfile C:/Users/tziuka-pc/Desktop/dev2/android-sdk-windows\platform-tools/lib/dx.jar

UnityEngine.Debug:LogError(Object)
PostProcessAndroidPlayer:BuildDex(String, String) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/BuildPipeline/PostProcessAndroidPlayer.cs:634)
PostProcessAndroidPlayer:PostProcess(BuildTarget, String, String, String, String, String, String, BuildOptions) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/BuildPipeline/PostProcessAndroidPlayer.cs:249)
UnityEditor.HostView:OnGUI()

我还为 Admob 使用了一个插件。当我删除这个插件时,一切顺利。我怎样才能解决这个问题?

4

1 回答 1

0

根据文档,这很可能是由过时的 Java 版本引起的。尝试更新您的 Java 安装。

构建 DEX 失败
这是一个错误,将产生类似于以下的消息:-

Building DEX Failed! G:\Unity\JavaPluginSample\Temp/StagingArea> java
-Xmx1024M -Djava.ext.dirs="G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/"
-jar "G:/AndroidSDK/android-sdk_r09-windows\platform-tools/lib/dx.jar" 
--dex --verbose --output=bin/classes.dex bin/classes.jar plugins Error occurred 
during initialization of VM Could not reserve enough space
for object heap Could not create the Java virtual machine. This is
usually caused by having the wrong version of Java installed on your
machine. Updating your Java installation to the latest version will
generally solve this issue.
于 2013-09-04T14:30:44.577 回答