Unknown error when building simple scene

Hi!

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

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)

Any ideas?

Michixxxx

This should definitely not happen. What version of Unity are you running?

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?

It looks like something has changed on Android SDK r22 that afffects Unity. General notes for Android r22:

SDK Tools release notes  |  Android Studio  |  Android Developers

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:

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)

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

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.

Same problem, same solution.

I suppose that we have to wait to upgrade to r22 until Unity releases a revision.

EDIT: Follow this link to get back r21:

Same problem, same solution. Just adding a quick link for
https://dl.google.com/android/installer_r21-windows.exe

You might need to update “Android SDK Platform-tools” if you’re installing r21 over r22, like I did.

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.

1 Like

Also had the same problem, same solution. Used the r21.1 bundle from:
http://dl.google.com/android/adt/adt-bundle-windows-x86_64-20130219.zip

Tank you very much! That very help me!

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!

Thank’s Jvil, your solution worked for me too and saved me from an increasing headache.

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! :slight_smile:

thank you very very much, this problem make me crazy…

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

thank you !!

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.

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.

I am also writing in to confirm that this is a known and serious problem with Unity and that a fix is required.

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.