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

来源:-

SwordArt

2017-10-20 11:55

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

写回答 关注

8回答

  • Oscar
    2017-10-20 16:50:17

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

    SwordA...

    老师,在吗?我已经上传了错误报告了,能帮我看一下吗,谢谢!

    2017-10-21 14:52:45

    共 1 条回复 >

  • weixin_慕仔7283935
    2019-06-28 00:07:42

    怎么弄的哎

  • 慕粉1535475712
    2018-06-06 20:16:09

    Build completed with a result of 'Failed'

    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


  • dposeidon
    2017-11-14 16:50:23

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

  • qq_切丶随缘丨縂队_0
    2017-11-01 18:24:57

    我也遇到了这个问题

  • SwordArt
    2017-10-22 12:13:01

    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)

  • SwordArt
    2017-10-20 23:10:07

    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)


  • SwordArt
    2017-10-20 17:59:30

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

    //img1.mukewang.com/59e9c8f60001622910680109.jpg

    //img2.mukewang.com/59e9c8f60001575110750346.jpg

    //img1.mukewang.com/59e9c8f70001726a10720351.jpg


带你开发类似Pokemon Go的AR游戏

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

29394 学习 · 220 问题

查看课程

相似问题