在Unity中,错误消息:无法构建apk

时间:2017-10-08 12:53:28

标签: android unity3d plugins

我创建了一个项目并将平台切换到android, 并更改包标识符。

我只是测试构建并运行但它出现在错误消息中。 首先,

**CommandInvokationFailure: Failed to build apk.**
C:\Program Files\Java\jdk1.7.0_79\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:\Users\UserName\AppData\Local\Android\Sdk\tools" -Dfile.encoding=UTF8 -jar "E:\StudyProject\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -


stderr[
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/sdklib/build/ApkCreationException : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:274)
    at SDKMain.main(SDKMain.java:128)
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

和第二,

**UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.**


at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83 
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

我之前安装了Unity,但没有设置。

我不知道为什么会出现这种问题。

如果您了解它,请帮助我。

1 个答案:

答案 0 :(得分:0)