Search Issue Tracker

Fixed in 2017.1.0f3

Fixed in 5.4.X, 5.5.X, 5.6.X

Votes

39

Found in

5.5.2f1

2017.2.0f3

Issue ID

888859

Regression

Yes

Android Build fails when the latest Android SDK Tools 25.3.1 version is used

Android

-

How to reproduce:
1. Update Android SDK Tools to 25.3.1
- In Mac open Android Studio -> Check for updates and update Android Studio version (might be not necessary)
- In Android Studio -> Preferences -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools
2. Create a new Unity project
3. Build and run on Android device
Result: Build fails "CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details. ..."

Reproducible: 5.5.2p2, 5.6.0b11, 2017.1.0a3

Note: I haven't been able to reproduce this issue on Windows machine. As after update via Android Studio, SDK Manager still doesn't see SDK Tools 25.3.1 version and uses 25.2.5

Workaround for the customers.

1) just open https://developer.android.com/studio/index.html
2) scroll down to the bottom of that page
3) go to downloads
4) scroll down to the bottom of that page
5) find Windows "tools_r25.2.3-windows.zip" download and unzip it
5) find MacOSX "tools_r25.2.3-macosx.zip" download and unzip it.
6) In the SDK path replace the tools folder.

FIXED:
Unity versions: 5.4.5p2, 5.5.3p3, 5.6.0p3, 2017.1.0b3
SDK Tools have to be updated to 26.x.x

Comments (171)

  1. alexxg

    Feb 15, 2018 05:54

    This is not fixed as of latest Unity. I will try the plethora of solutions offered, been through half of them already...
    The followed the Unity Android setup instructions exactly and this happens.

  2. farshidhss

    Feb 14, 2018 09:47

    This is crazy! I'm on latex Unity 2017.3.0f3 and this issue exists!!! Could someone find a workaround?

  3. ecequalsm2

    Feb 12, 2018 17:26

    @ASHGENEVIE I tried using the 26.0.0 Build Tools and then the 26.0.3 version. But it doesn't seem to make any difference. I don't have the NDK installed at all though. I never did and it worked fine before. So, based on this error I'm still getting, do I need to install the NDK (Not sure since I'm using a Mac)? I have the JDK version 1.8_161, as you suggested, and I replaced the tools folder with the 25.2.5 version that was supposed to be a fix. But still the same error:
    CommandInvokationFailure: Failed to re-package resources.
    /Users/milliemilagne/Game Dev/Android/sdk/build-tools/26.0.3/aapt package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "/Users/milliemilagne/Game Dev/Android/sdk/platforms/android-26/android.jar" -F bin/resources.ap_ --extra-packages com.android.vending.billing:com.unity.purchasing.googleplay:com.google.example.games.mainlibproj:com.onesignal.onesignalsdk:com.unity.purchasing:android.support.customtabs:com.sglib.easymobile.androidnative:com.onesignal:com.google.android.gms.auth.api:com...

  4. ashgenevie

    Feb 10, 2018 13:54

    I wish I could edit comments on here...

    Extra step, after following the steps below, if you are still having problems:

    Go back to the SDK Manager, go to SDK tools tab, scroll down, and make sure Android SDK Platform tools is checked. If not, check it, click apply, and run the installation.

    Cheers!
    Ash

  5. ashgenevie

    Feb 09, 2018 12:09

    An added note, you also need to make sure your Build Tools are the 26.0.0 version. To do this, go to the SDK Manager in Android Studio. Go to Appearance & Behavior > System Settings > Android SDK. Then, click the "SDK Tools" tab. Check the "Show Package Details" selection at the bottom right of the window. Under Android SDK Build Tools, deselect any current checked version and check the 26.0.0 version. Click Apply, continue the installation. Once done, close Unity, open it again, and you shouldn't receive the build error anymore.

  6. ashgenevie

    Feb 09, 2018 11:42

    Found a solution:
    1. Follow the workaround above by downloading the 25.2.3 revision of the tools. To find the download link, Google search "tools_r25.2.3-windows.zip" or "tools_r25.2.3-macosx.zip" and the link will be the first listed from the dl.google.com website.
    2. Replace the contents of the "tools" folder in that download with the "tools" folder where you Android SDK is located. Tip: I recommend moving the Android SDK to a more accessible location to easily work with it. You can do this in the SDK Manager of Android Studio.
    3. Once this is done, in Unity, under "External Tools", for the Android SDK setting, click Browse and choose the location of the Android SDK folder (this will be one folder up from the "tools" folder that you replaced, not the actual "tools" folder")
    4. Then, close Unity, open it again, and see if it works.
    5. If you then receive an error stating "Cannot determine Java Version from...", then you also need to downgrade your Java JDK. This was my problem as well. I solved it by installing the Java SE Development Kit 8, or as listed on the Java website as: 8u161.
    6. Then, back in Unity, under "External Tools", for the Java setting, click Browse and choose the Java version 8 folder. Unless you renamed it, the folder should be named "jdk1.8.0_161". Unless you set to install it somewhere else, it's path should be: C:/Program Files (x86)/Java/jdk1.8.0_161.
    7. In addition, also ensure that your NDK setting in external tools is set to the "android-ndk-r13b" folder. If you haven't already, you need to download the NDK Revision 13b version by clicking Download next to the setting, and once done clicking Browse and selecting where you installed it.

    Note to Unity: I'd like to say that I am dissapointed that it takes users having to downgrade to older versions of the Android SDK, Java JDK, and Android NDK in order to be able to build any type of Android app directly from Unity. As software developers, we should be more professional than this. I hope that Unity developers are actually working to fix this issue. If not, we should atleast have a guide that states that Unity users deploying to Android should be using these versions. It's as simple as that. Otherwise, your users are scrambling to fix a problem, with real-world deadlines and real-world stresses. Unity developers, you've created a tremendously useful and powerful program, but without understanding your user and his/her problems, you are lessening its usefulness and simply giving people headaches. I urge you to understand our frustration and hopefully act to prevent it.

  7. Spawn2x

    Feb 09, 2018 02:36

    jgwinner, big thank you, worked for me!

  8. Raeion

    Feb 09, 2018 02:17

    This problem still persists in the latest version can we open this issue so we can vote on it? none of the solutions worked for me.

  9. MikDab

    Feb 02, 2018 12:42

    One more thing - if you're tinkering with the Gradle stuff, I recommend making sure that it syncs properly in Android studio, since if it does not - that means that there are some errors and building from Unity will probably not work either. The setup I posted below resulted in my Gradle and Android studio functioning properly with no errors.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.