为了账号安全,请及时绑定邮箱和手机立即绑定

老师,为什么出现failed to build apk,see the console。

在编译安卓apk时,creating package时出现的这个问题,网上也找不到解决办法,能否请老师解答一下,谢谢。

正在回答

8 回答

Console 输出什么错误?请截图上传.谢谢

0 回复 有任何疑惑可以回复我~
#1

SwordArt 提问者

老师,在吗?我已经上传了错误报告了,能帮我看一下吗,谢谢!
2017-10-21 回复 有任何疑惑可以回复我~

怎么弄的哎

0 回复 有任何疑惑可以回复我~

Build completed with a result of 'Failed'

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


0 回复 有任何疑惑可以回复我~

Java版本的问题,你的版本是jdk-9.0.1,换成或者切换成jdk1.8就可以了,unity里面重新链接一下

0 回复 有任何疑惑可以回复我~

我也遇到了这个问题

0 回复 有任何疑惑可以回复我~

CommandInvokationFailure: Failed to build apk.

C:/Program Files/Java/jdk-9.0.1\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/lenovo/AppData/Local/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "G:\unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[

Exception in thread "main" java.lang.reflect.InvocationTargetException

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:564)

at SDKMain.main(SDKMain.java:130)

Caused by: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder

at com.android.sdklib.internal.build.SignedJarBuilder.<init>(SignedJarBuilder.java:177)

at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)

at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)

at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)

at UnityApkBuilder.<init>(UnityApkBuilder.java:214)

at UnityApkBuilder.main(UnityApkBuilder.java:34)

... 5 more

Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder

at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)

... 11 more

]

stdout[

]

exit code: 1

UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)

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)

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Build completed with a result of 'Failed'

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

0 回复 有任何疑惑可以回复我~

CommandInvokationFailure: Failed to build apk.

C:/Program Files/Java/jdk-9.0.1\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/lenovo/AppData/Local/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "G:\unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -


stderr[

Exception in thread "main" java.lang.reflect.InvocationTargetException

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:564)

at SDKMain.main(SDKMain.java:130)

Caused by: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder

at com.android.sdklib.internal.build.SignedJarBuilder.<init>(SignedJarBuilder.java:177)

at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)

at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)

at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)

at UnityApkBuilder.<init>(UnityApkBuilder.java:214)

at UnityApkBuilder.main(UnityApkBuilder.java:34)

... 5 more

Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder

at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)

... 11 more

]

stdout[


]

exit code: 1

UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)

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)

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Error building Player: 2 errors

Build completed with a result of 'Failed'

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors

  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x00207] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:172 

  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83 

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


0 回复 有任何疑惑可以回复我~

好的,谢谢老师。以下是我的错误报告:

//img1.sycdn.imooc.com//59e9c8f60001622910680109.jpg

//img1.sycdn.imooc.com//59e9c8f60001575110750346.jpg

//img1.sycdn.imooc.com//59e9c8f70001726a10720351.jpg


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
带你开发类似Pokemon Go的AR游戏
  • 参与学习       29376    人
  • 解答问题       220    个

用 Unity 3D开发AR游戏,分有卡和脱卡两种情况,并导出Android和iOS平台

进入课程

老师,为什么出现failed to build apk,see the console。

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信