Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by john062902 · Oct 03, 2017 at 10:44 PM · android build

Android APK build failed error. How do I fix this?

So I'm trying to upload this simple game I've made on Unity to Android. Unfortunately, whenever I attempt to build it I get this error in my console:

Error building Player: CommandInvokationFailure: Failed to build apk. See the Console for details. C:/Program Files/Java/jdk-9\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Owner/Desktop/sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Users/Owner/Downloads/Unity 4.6/Editor/Data/BuildTargetTools/AndroidPlayer\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:201) at UnityApkBuilder.main(UnityApkBuilder.java:28) ... 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[

]

I am extremely new to Unity, app-developing, and programming in general, so please, if you could, try and make your answer as simple as possible, as most of the answers I've found in other forums either don't work or I don't understand. Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
6
Best Answer

Answer by CharlesWard · Oct 04, 2017 at 08:23 PM

It seems that Java 9 removed the sun/misc/BASE64Encoder class.

A workaround is to downgrade to Java 8.

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JosepJF · Oct 04, 2017 at 10:49 PM 0
Share

fixed! ty Charles

avatar image john062902 · Oct 06, 2017 at 01:03 AM 0
Share

Where might I find JD$$anonymous$$ 8? The downloads page only had version 9.

avatar image Litleck john062902 · Oct 06, 2017 at 02:00 AM 0
Share

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

avatar image john062902 · Oct 06, 2017 at 02:00 PM 0
Share

Hey, It works! Thanks a lot, you just saved me a ton of frustration!

avatar image SirDef11 · Oct 06, 2017 at 02:11 PM 0
Share

Yes, just download the 8 and change the path in your project settings... All those problems omfg...

avatar image kwapi98 · Oct 09, 2017 at 06:25 AM 0
Share

I cannot change my JD$$anonymous$$ path in External Tools, please help, Im a newbie in Unity

avatar image SirDef11 kwapi98 · Oct 09, 2017 at 11:50 AM 0
Share
  1. Download and Install JD$$anonymous$$ 8 : http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  2. In Unity : Edit → Preferences → External Tools , then pull the bottom of this window, and you will see the Android Path Browse Button (yes it is well hidden, for nothing...)

  3. Click Browse and find where you installed the JD$$anonymous$$ ( C/Programs/Java/Jdk1.8 ) One bug fixed now, have fun with the next one ^^

avatar image
5

Answer by SirDef11 · Oct 09, 2017 at 11:51 AM

  1. Download and Install JDK 8 : http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  2. In Unity : Edit → Preferences → External Tools , then pull the bottom of this window, and you will see the Android Path Browse Button (yes it is well hidden, for nothing...)

  3. Click Browse and find where you installed the JDK ( C/Programs/Java/Jdk1.8 ) One bug fixed now, have fun with the next one ^^

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MrJamieMcC · May 09, 2018 at 09:40 PM 0
Share

Thank you so much!

avatar image amanat361 · May 31, 2018 at 06:01 AM 0
Share

I logged in for the first time ever on these forums and this is my first comment, just to say thank you. I've been working for 6 f'ing hours on getting my first game to work on my phone and after step by step of going on the forums, doing this, doing that, doing this, doing that, you'rs was the final answer. I did it, it worked. Game worked. Everything worked. $$anonymous$$y life worked. Suddenly I could see everything clearly and my life just came back together with that glorious few seconds. This message...your message, was the best thing I've came across all month. Thanks buddy!

https://i.imgur.com/FdhhJYJ.png

avatar image SirDef11 amanat361 · May 31, 2018 at 09:23 AM 0
Share

You're welcome. I had the same feeling the first time lol ^^ Now if you decide to continue, have fun with the next bugs. (currently, i'm at a problem with no solution... after 200 or 300 hours of work, just imagine the desilusion...). Have fun anyway ^^

avatar image
0

Answer by JosepJF · Oct 03, 2017 at 10:52 PM

Same problem...

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by EdwinSly · Jan 05, 2018 at 03:01 AM

Watch this video: https://youtu.be/UaQe-fnsM4w

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by cpsstudios · May 19, 2018 at 09:26 PM

I know this is late... but I concur!!! This worked for me!!! Kudoz to the one that figured this out. Thanks.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

78 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

lightmap comes out blurry on android device 0 Answers

GPU warning Post Processing Stack android 0 Answers

Frame Rate jumps between 20 to 8000 ( in thousands) continuos and periodically. 0 Answers

UnityEditor.BuildPlayerWindow+BuildMethodException - Anyone guide to solve this ERROR please??? 0 Answers

polygoncollider2d does not work on device? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges