I gave up on building this to android

Just wanted to share my real experience here.

I completed the game up to this point on Unity 5.

I was able to get the game playing properly using the Unity Remote (5) app on my connected phone.

I attached android SDK and Java JDKs to unity and tried to get this to build to android, but it won’t and I can’t figure out what is wrong with it at all.

1 Like

Hi,

Sorry to hear you have had some difficulties with this.

What happens when you do build it, do you get an error, or does it complete without errors etc?

a window pops up that says “Failed to build apk. See the Console for details.” and the console…

CommandInvokationFailure: Failed to build apk.
C:/Program Files/Java/jdk-9.0.1\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir=“X:/Downloads/tools_r25.2.5-windows\tools” -Dfile.encoding=UTF8 -jar “C:\Program Files\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.(SignedJarBuilder.java:177)
at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
at com.android.sdklib.build.ApkBuilder.(ApkBuilder.java:422)
at com.android.sdklib.build.ApkBuilder.(ApkBuilder.java:362)
at UnityApkBuilder.(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[

]
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()

1 Like

Try to use JDK 8 and not 9… maybe there is some bug with the JDK9 and unity.

2 Likes

Would you like me to have a go at this end also? Just to see what happens? If so, zip the project files up and pop a link up in your reply (the forum will only receive uploads to 10mb in size) to the zip file. Also, let me know which specific version of Unity you used.

Try to use JDK 8 and not 9… maybe there is some bug with the JDK9 and unity.

I was thinking along the same lines, e.g. something to do with the versions of the 'dks…

1 Like

I’m using this JDK version and its working well: jdk1.8.0_152
Also Ive installed the whole Android Studio package.

1 Like

Well, I guess that JDK was the problem because it worked now! Thanks for the help!

Do you know of anything that I could look at to gain more of an understanding of APK/SDK/all of this extensions ****?

I’ve previously built applications from Gamemaker and published to the Google Play store and it was just as big of a nightmare…

1 Like

Yeah ! I’m using Jdk 8 too, but i find android studio package a bit heavy … I recommend using sdk manager console… a little bit more complicated but no extra and useless files :slight_smile:

1 Like

If you want my opinion, if it’s working, just keep it like this ! No need to upgrade to any newer version for SDK/JDK if it work with Unity… There are no benefit to use the last version as far as i know

1 Like

Great to hear you have it working and good suggestion @GrossePistache / @Kookgek .

Regarding the question, I tend to just wait until things go wrong, and then start trawling the web :slight_smile:

Which is exactly how I had found this, just before seeing your update :wink:

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms