我正在尝试在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使用了一个插件。当我删除这个插件时,一切顺利。我该如何解决这个问题?
答案 0 :(得分:0)
作为per the documentation,这很可能是由过时的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.