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 $$anonymous$$ · Sep 25, 2017 at 05:43 PM · build-errorsdkjava

How do I solve CommandInvokeFailure?

Hello. The problems have started yesterday, when I couldn't build my android game because unity couldn't "list target platforms". I looked up the solution in the internet and it really helped me. But then unity started saying: "CommandInvokationFailure: Failed to build apk." I looked for the solution again (link) but it didn't work.

Here is the whole report:

CommandInvokationFailure: Failed to build apk.

C:/Program Files/Java/jdk-9\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Turar/AppData/Local/Android/sdk\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:129) 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[

] 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.WaitingForProc essToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.HostView:OnGUI()

What should I do?

P.S: I also thought that the problem is with my keystore but it's not

P.P.S: I have the latest SDK version and unity5.6.0f3

Thanks in advance!

Comment
Add comment · Show 6
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 abarrak · Sep 26, 2017 at 12:20 AM 0
Share

Hey there!

I have the exact same problem, did you fix it?

avatar image $$anonymous$$ abarrak · Sep 26, 2017 at 11:00 AM 0
Share

Hi,

Unfortunately, no. The only possible solution I see, as of now, is to reinstall everything :(.

But if you find one, could you please notify me?

Thank you.

avatar image hexagonius · Sep 26, 2017 at 04:44 AM 0
Share

Did you accidentally download the 32 but version of the sdk while building 64, or vice versa?

avatar image $$anonymous$$ hexagonius · Sep 26, 2017 at 10:57 AM 0
Share

Hello! I downloaded the 64bit version of the sdk. The latest one.

avatar image hexagonius $$anonymous$$ · Sep 26, 2017 at 07:04 PM 0
Share

Prior to unity 2017, 64 bit was experimental. Did you check that you build for 64 bit on player settings for android?

Show more comments

2 Replies

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

Answer by $$anonymous$$ · Sep 27, 2017 at 09:22 PM

Ok, whoever reads it, I got the solution.

After hours of searching the internet I read that sometimes Unity doesn't work properly with the last versions of JDK. So I downgraded my JDK from 9 to 8 and installed 86bit version. Now it works fine.

Comment
Add comment · Show 5 · 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 Frank-Grimes · Oct 01, 2017 at 03:55 AM 2
Share

Thanks for taking the time to post your solution after hours of troubleshooting!

avatar image dmennenoh · Oct 03, 2017 at 09:49 AM 0
Share

Yes, thank you! Finally made an .apk

avatar image $$anonymous$$ dmennenoh · Oct 03, 2017 at 06:14 PM 0
Share

No problems, mate :)

avatar image CincyWong · Oct 13, 2017 at 11:52 PM 0
Share

Thanks, worked perfectly!

avatar image AmirSavand · Oct 17, 2017 at 01:05 PM 0
Share

Dude, thanks, I searched hours... Finally I started to actually read the error, then searched this line:

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

And found your AWESO$$anonymous$$E answer.

avatar image
0

Answer by abarrak · Sep 26, 2017 at 03:56 PM

My concern is that there is an article that talks about don't use the sun package in a java project so why is unity doing that? http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html

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

76 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

Related Questions

unable convert classes into dex format 0 Answers

Admob Build Error ? 0 Answers

Java error when building 1 Answer

I have a problem with JAVA_HOME. It says its set to C:\Program Files\Java\jdk-10.0.1\bin but i have changed it pls help 4 Answers

Failed to find Build Tools revision 29.0.0 - Android Builds 4 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