Search Unity

  1. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  2. Unity 2017.1 is now released.
    Dismiss Notice
  3. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  4. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

unknown error when building simple scene

Discussion in 'Android' started by Michixxx, Apr 3, 2013.

  1. Michixxx

    Michixxx

    Joined:
    Mar 22, 2013
    Posts:
    4
    Hi!

    I just tried to build a very simple test scene for android and I get this error:

    Code (csharp):
    1. Error building Player: Exception: android (invokation failed)
    2. ERROR: unknown error
    3. cmd:android list target -c
    4. stdout;
    5. stderr:
    6. Exception in thread "main" java.lang.NullPointerException
    7.     at SDKMain.main(SDKMain.java:62)
    8.  

    Any ideas?

    Michixxxx
     
  2. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    524
    This should definitely not happen. What version of Unity are you running?
     
  3. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    524
    Oh, I think I may have an idea what the problem is. Try firing up the "Android SDK Manager" and make sure you have the latest version of both "Android SDK Tools" and "Android SDK Platform-tools" installed.

    If that doesn't work can you please list the contents of you Android SDK platform-tools directory?
     
  4. jvil

    jvil

    Joined:
    Jul 13, 2012
    Posts:
    259
    It looks like something has changed on Android SDK r22 that afffects Unity. General notes for Android r22:

    http://developer.android.com/tools/sdk/tools-notes.html

    A quick solution for me was rollback to revision 21. On r21 all went fine, but on r22 it prompts me for the Android SDK location when compiling, and then throw this error on Unity console:

    Code (csharp):
    1. Error building Player: Exception: android (invokation failed)
    2. ERROR: unknown error
    3. cmd:android list target -c
    4. stdout;
    5. stderr:
    6. Exception in thread "main" java.lang.NullPointerException
    7.     at SDKMain.main(SDKMain.java:62)
    8.  
    Android r21 platform-tools content:
    aapt.exe
    adb.exe
    AdbWinApi.dll
    AdbWinUsbApi.dll
    aidl.exe
    api
    dexdump.exe
    dx.bat
    fastboot.exe
    lib
    llvm-rs-cc.exe
    NOTICE.txt
    renderscript
    source.properties

    Android r22 platform-tools content:
    adb.exe
    AdbWinApi.dll
    AdbWinUsbApi.dll
    api
    fastboot.exe
    NOTICE.txt
    source.properties

    Maybe there are more changes on some other folders, but I'm not sure what files uses Unity to compile, will be nice some information here or how to fix this issue, thanks
     
    Last edited: May 16, 2013
  5. CoderBear

    CoderBear

    Joined:
    Feb 27, 2013
    Posts:
    12
    IT was because the build tools were seperated with this release and as seems to be "par for the course". Unity has not responded to this. Which is sad as a Unity Developer had a session at Google I/O today.

    Perhaps this will be address in the elusive Unity 4.1.3 update.
     
  6. drlecks

    drlecks

    Joined:
    May 16, 2013
    Posts:
    2
    Last edited: May 16, 2013
  7. AndriiM

    AndriiM

    Joined:
    Jul 25, 2012
    Posts:
    6
  8. jvil

    jvil

    Joined:
    Jul 13, 2012
    Posts:
    259
    For those who want to compile with Android r22 without waiting the update from Unity, just copy the content from folder:

    android-sdk/build-tools/17.0.0/ <-- build tools for api 17

    to

    android-sdk/platform-tools/

    Not the best solution but works.


    Hope it helps.
     
    SimonPan likes this.
  9. Bytegrove_

    Bytegrove_

    Joined:
    May 16, 2013
    Posts:
    1
  10. Liu Jie

    Liu Jie

    Joined:
    Mar 28, 2013
    Posts:
    1
    Tank you very much! That very help me!
     
  11. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    154
    I just purchased the Android upgrade. New Mac, New Java, New Unity, new Android upgrade.. lot of money spend.. just to find that in fact the Unity software does not work.

    ***
    Error building Player: Exception: android (invokation failed)
    ERROR: unknown error
    cmd:android list target -c
    stdout;
    stderr:
    Exception in thread "main" java.lang.NullPointerException
    at SDKMain.main(SDKMain.java:62)
    ***

    Seriously, Unity - at least give instructions on how to work around, provide some files that works. Or stop selling the product till you make it work.

    I know I should not post in forums when angry, but I really think it is outrageous to sell expensive software that just do not work with the instructions and files provided. It does not work! Not a small bug, it cannot do anything, does not work. Comon!
     
  12. sfilo

    sfilo

    Joined:
    Oct 23, 2012
    Posts:
    20
    Thank's Jvil, your solution worked for me too and saved me from an increasing headache.
     
  13. Velvety

    Velvety

    Joined:
    May 4, 2009
    Posts:
    150
    Thank you! This was driving me nuts for 3 days! I only installed the Android SDK for the first time this week so I had no idea there was a "previous" directory structure and that it had changed. Your listed fix worked great for me, cheers! :)
     
  14. yujingbo

    yujingbo

    Joined:
    May 22, 2013
    Posts:
    4
    thank you very very much, this problem make me crazy...
     
  15. kaushik-d

    kaushik-d

    Joined:
    Aug 25, 2011
    Posts:
    19
    Thank you jvil! This worked for me. On a mac, instead of android-sdk/build-tools/17.0.0/ I had to copy the contents of android-sdk/build-tools/android-4.2.2
     
  16. wiki1135

    wiki1135

    Joined:
    May 22, 2013
    Posts:
    1
    thank you !!
     
  17. Zyphxion

    Zyphxion

    Joined:
    Mar 27, 2013
    Posts:
    1
    Running into this issue this evening, quite infuriating. I'll try the solutions posted in this thread and edit this post with the results.

    EDIT: Totally fixed all issues.
     
    Last edited: May 23, 2013
  18. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    154
    I just had answer from Unity support.

    They tell me that it is because I was not following instructions.

    Can you guys please write them as well and tell them that I am not alone and stupid, there is a r22 issue, it does not work? They do not believe me, it's rather stupid.

    Thanks.
     
  19. Daveoh

    Daveoh

    Joined:
    Mar 15, 2011
    Posts:
    5
    I am also writing in to confirm that this is a known and serious problem with Unity and that a fix is required.
     
  20. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    982
    I've just had the same problem, I'm using Unity 3.5.7 I hope they fix it for this soon as I have a clients software to release that previously worked.
     
  21. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    524
    Hi Everyone,

    As you all have noticed, Google released a new version of the SDK last week that is incompatible with Unity. Until we can get a fix published the best way to solve this is probably to make a separate installation of the SDK rev21 and make sure not to update that. You can have multiple SDKs installed at the same time, just make sure that the one configured in the Editor "Unity Preferences -> External Tools" is of revision 21.
     
  22. jvil

    jvil

    Joined:
    Jul 13, 2012
    Posts:
    259
    Same error happened on Unity when Android introduced the platform-tools folder. Maybe would be nice to rely on global variable $PATH to compile for Android instead of hardcode these values based on the Android SDK structure folder to avoid that happens again.

    This will leave SDK changes to end-user without upgrading Unity just for this reason.

    It's just an idea, I don't know which other implications could have this on Unity.
     
  23. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,166
    Where can you download that for mac?
     
  24. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    154
    So, are these the official Unity instructions now?

    Then you really ought to

    A) Provide a serious set of instructions!
    Somewhere in one of the many treads about this bug of the software not at all working as sold, you post at page 2: "the best way to solve this is probably".. probably? At least provide a link to the r21 files, and a couple of screenshots! Help the single individual who fights with this, don't just post "Hi everyone" somewhere, and expect things to be solved.

    B) Change the text in your various documentation, because people like me who pay a lot of money for your software now has to have a really poor experience, as the official documentation tells you to:
    Go to the Android Developer SDK webpage. Download and unpack the latest Android SDK.

    C) Tell your support that the latest release DID NOT fix the problem, contrary to what was indicated to me before that release. And that this is NOT a Google bug as I am told, it is in fact a Unity bug: You sell the software to work with the latest version of Android, that is what your official documentation states and instructs, that is what I payd you for. Google do not release software to work with Unity. You sold me expensive software to work with the latest Android SDK. And it does not.

    It's like you think we are the co-developers out here. This is not free and open software, stop acting as if it was. I am sure your legal department would not like us to "take things a little light"? We have a contract, a lot of money are involved, I paid you.


    "Google released a new version of the SDK last week that is incompatible with Unity."

    No.

    Unity sold me software to be compatible with the latest version of the SDK, and it is not! And you are not taking it serious.

    Good companies would contact everyone they charged money from in the period where the software did not work as sold to do, and they would appologize, compensate by something nice like a free upgrade or something, and they would provide good official instructions on how to work with what we have while they made a patch.

    I don't even think it's legal the way you do things.
     
  25. dragonstar

    dragonstar

    Joined:
    Sep 27, 2010
    Posts:
    193
    guys i got this error on my mac :eek:

    Error building Player: Exception: android (invokation failed)
    ERROR: unknown error
    cmd:android list target -c
    stdout;
    stderr:
    Exception in thread "main" java.lang.NullPointerException
    at SDKMain.main(SDKMain.java:62)


    you know how to fix:confused:
     
  26. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    154
    Welcome to the sad club of people fighting Unity on this topic ;/

    According to Unity "Google released a new version of the SDK last week that is incompatible with Unity".

    Some of us think it's the other way around: My personal experience is that Unity sold me software to be working with the latest Android SDK, but at the time of purchase it did in fact not work as sold to do. It's not even an upgrade-thing in my case, it did not work when I purchased.

    And it is still not working, and there still is no official documentation on how to work around while they make a patch. And not a single apology or word about compensation for selling me a thing that does not work as it was sold to do. Support has stopped answering me.

    The only response from Unity to date (to my concern) is somewhere in this very tread, where you can read "the best way to solve this is probably to.." But the instructions are poor - see for yourself if you are able to follow them? There are no links to the file you need on your Mac, and it's hard to find. You cannot follow the official documentation for your product, it will cause that very error.

    There are other hacks around, made by skilled users. But they are ugly by nature, not straight forward, and you cannot be sure what causes bugs or exactly what you will be running on the Android.

    Still - try and look around and see if you find an interesting hack ;) The good news is that it IS possible to get something running on the Android.
     
  27. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    154
    If Android support was PART of the Unity Pro package, I'd be willing to accept this now "missing feature".

    But may I remind everyone that it is not: Unity charges USD 1,500 ex VAT for the base product.

    On TOP of that, a dedicated Android product is purchased, for either USD 400 ex VAT or another USD 1,500 ex VAT.

    When you sell a dedicated Android add on, and documentation for that ISOLATED PURCHASE is all very clear about "latest Android SDK", it is NOT just a minor bug when it is not at all working.

    At least the documentations should be clear, but I think it's not the acts of an honest company who sells something that does not work and then just be ignorant about it - Unity: You need to compensate any one who purchased the product that did not work as sold to do at the time of purchase.

    If I buy an adapter for my phone as a separate purchase, and the label states "Works with the latest phone version", I expect a pretty fair treatment/upgrade/replacement if the adapter does in fact not work with the latest phone version as stated. Not just a story on how the phone manufacturers changed standards and a tip about chewing gum that probably will work.

    Unity: Your product does not work as you sold it to me to do. Act accordingly as you'd expect any other business partner to do! This is not free software.
     
  28. dragonstar

    dragonstar

    Joined:
    Sep 27, 2010
    Posts:
    193
    then no way to downgrade the android sdk ?
     
  29. Sparkline

    Sparkline

    Joined:
    Feb 8, 2013
    Posts:
    44
    What I did:
    - Downloaded latest android SDK - http://developer.android.com/sdk/index.html
    - Unzipped to necessary folder it and started Android SDK Manager
    - After you start it wants to update some packages. In "Tools" category "Android SDK tools" is also flagged to update to rev.22. Just clear the checkbox and update/install other packages you need. The rev. of android sdk tools will remain 21.
    - In Unity go to Edit->Preferences->External Tools->Android SDK location and show your sdk folder.
    After that Unity can build apk.

    All that means that Unity doesn't support android sdk tools rev.22. After Unity will give the update that will support it we can easy update android sdk tools to rev. 22 from SDK manager.

    If you already have sdk updated to rev.22 and you want to downgrade to 21 and can't wait for Unity will fix it you can unzip downloaded latest android SDK archive to another folder. And it will work as another instance. Just show the Unity this folder as SDK location and enjoy.
     
  30. dragonstar

    dragonstar

    Joined:
    Sep 27, 2010
    Posts:
    193
    i have a mac can this work on the same way ?
     
  31. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    524
  32. dragonstar

    dragonstar

    Joined:
    Sep 27, 2010
    Posts:
    193
    thanks man i give a try
     
  33. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,166
  34. cirolve

    cirolve

    Joined:
    May 28, 2013
    Posts:
    2
  35. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,656
  36. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,656
    So you got to install revision 21, but make sure not to install the rev22 tool update because then it doesnt work again. Pain in the ass but it works.
     
  37. gaitat

    gaitat

    Joined:
    May 29, 2013
    Posts:
    6
  38. Sir-Tiddlesworth

    Sir-Tiddlesworth

    Joined:
    Oct 19, 2011
    Posts:
    907
  39. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    81
    Nothing works for me :(

    I had Unity 4.1.3 and tried all solution with Android SDK r22 and r21, NO CHANCE
    I went back to Unity 3.5.latest and tried all solution with Android SDK r22 and r21, NO CHANCE

    Always same error

    ERROR
     
  40. jvil

    jvil

    Joined:
    Jul 13, 2012
    Posts:
    259
    Usually this error will be thrown when you try and load a class thats been compiled with an incompatible version of Java. Try upgrading your JVM.
     
  41. SeanH

    SeanH

    Joined:
    Apr 21, 2013
    Posts:
    1
    Fantastic. Thanks a lot; I have just started playing around with Android development after the add-on for it became free, and I was having a ton of trouble getting anything to build with any version. Doing this fixed it, though.
     
  42. G.BERTHALON

    G.BERTHALON

    Joined:
    Jun 6, 2013
    Posts:
    1
    Work for me thanks!
     
  43. zombee81

    zombee81

    Joined:
    May 15, 2013
    Posts:
    7
    Had the same problem on 4.1.3, jvil you are a star! Works great now on my Acer A500 and my S4! :)
     
  44. rkstormer

    rkstormer

    Joined:
    Nov 26, 2012
    Posts:
    13
    I tried the solution posted here (copying the files into android-sdk/platform-tools/). It allowed me to compile and deploy to my Android device, but the game just hangs on startup.

    An ETA on the fix from Unity would be nice.
     
  45. rkstormer

    rkstormer

    Joined:
    Nov 26, 2012
    Posts:
    13
    Ah! So I just saw that Unity 4.1.4 is available. It fixes the build issue with the r22 update. My game is still hanging on launch when running on the device though so I'm thinking maybe the r22 update broke something else...
     
  46. Geo-Ego

    Geo-Ego

    Joined:
    Sep 25, 2012
    Posts:
    12
    Just wanted to put out there that I also saw the build issue fixed with v4.1.4, and haven't had any problems building or deploying after receiving this error with v4.1.3.
     
  47. elizeusz

    elizeusz

    Joined:
    May 2, 2012
    Posts:
    49
    Hi i installed unity 4.1.4 and this problem is still here :
    Error building Player: Exception: android (invokation failed)
    ERROR: unknown error
    cmd:android list target -c
    stdout;
    Error occurred during initialization of VM
    java/lang/NoClassDefFoundError: java/lang/Object
    stderr:

    I use r22 and r21 and theseme for both... after instalation of unity upgrade 4.1.4 i build the apk but after switch off my comptuer problem came back.
     
  48. elizeusz

    elizeusz

    Joined:
    May 2, 2012
    Posts:
    49
    Ok problem was with java.
     
  49. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    913
    Last edited: Jun 7, 2013
  50. lullaharsh

    lullaharsh

    Joined:
    Sep 9, 2012
    Posts:
    24
    thnx very very very much. I had been trying this from past few days. thnx again