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

unity5.6.4 打包apk失败?

/ 猿问

unity5.6.4 打包apk失败?

dposeidon 2017-11-14 14:46:27

http://img3.sycdn.imooc.com/5a0a900f0001e2c210260498.jpg

sdk和jdk路径都已经链接好了

jdk的版本是9.0.1

console里面显示的是

CommandInvokationFailure: Failed to build apk.
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/star/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/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.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.HostView:OnGUI()


请问是jdk版本的问题吗?要怎么解决?

unity更新以后困扰我很久了

查看完整描述

2 回答

已采纳
?
蒲公英wsg

可能是JDK版本问题,毕竟JDK9才出来,根本不可能兼容到9 

查看完整回答
反对 回复 2017-11-14
  • dposeidon
    dposeidon
    确实是版本的问题,替换jar1.8就可以了
  • 蒲公英wsg
    蒲公英wsg
    恩恩,你也是做安卓的?Android studio 3.0稳定版前段时间才发布,破天荒的才刚开始支持Java 8
  • dposeidon
    dposeidon
    小白一枚,搭载高通做安卓的增强现实,非程序员哈哈哈哈
点击展开后面1
?
慕标0095007

你好请问你问题解决了吗

我也碰到了和你一样的问题

查看完整回答
反对 回复 2018-02-12

添加回答

回复

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信