Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

cant build android

Discussion in 'Android' started by tyoc213, Apr 9, 2017.

  1. tyoc213

    tyoc213

    Joined:
    Nov 14, 2011
    Posts:
    166
    Hi there, I just installed latest unity3d on a win10 computer, installed JDK and android studio, did setup paths on external tools but can't make it to work

    Code (CSharp):
    1. CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
    2. C:/Program Files/Java/jdk1.8.0_121\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/tyoc/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
    3.  
    4. stderr[
    5. Error:Invalid command android
    6. ]
    7. stdout[
    8.  
    9. ]
    10. exit code: 64
    11. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    12. 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)
    13. UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    14. UnityEditor.HostView:OnGUI()
    15.  
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    2,061
    I'm running into the exact same error. I started a new project to make sure it wasn't related to my project, but I get this same error.

    I saw some other users complaining about this same issue, and how the 'android' command was deprecated/removed in the latest Android SDK. They recommended downloading an older version of the 'tools' folder and replacing my 'tools' with it. I tried that, but then I get an error along the lines of how version "0 < 24" or something like that.

    Can this issue be resolved by completely uninstalling the Android SDK, and installing a specific version of it, without manually messing with Tools? There isn't yet a patch for Unity that addresses this issue.

    Thanks.
     
  3. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,071
    Please search the forums before posting a thread like this - there are numerous reports about it.
    It's an issue with the latest Android SDK Tools. The fix is coming soon. As a workaround, downgrade your SDK tools to version 25.2.
     
  4. tyoc213

    tyoc213

    Joined:
    Nov 14, 2011
    Posts:
    166
    Well, I dont see the version you say, but I did have installed 25.0.2 which also didnt work, have tried at less 1 of each version without luck... guess I will need to wait until the updated versions popups up when I open again Unity3d.

    upload_2017-4-10_22-58-14.png
     
  5. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    2,061
    I ended up complete removing Android studio, along with the SDK, and installing version 2.2.2, which I found here:

    http://tools.android.com/download/studio/builds/2-2-2

    After that, I was able to build for Android. Just note that when you start up Android Studio, it will try to tell you to update. I opted not to, as I thought that might update me to one of the broken 2.3 releases that were causing issues.
     
  6. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,071
    @tyoc you're looking into "SDK Build Tools", I was talking of "SDK Tools".
    Latest update: we've released a fix on our side in 5.6.0p3, and an additional fix for the new ManifestMerger in 5.6.0p4.
    There's also a fix in the Android SDK.

    We are getting the fixes on our side into earlier versions as well. Please check the release notes.
     
  7. Gr8fulGamer

    Gr8fulGamer

    Joined:
    Apr 9, 2017
    Posts:
    2
    completely broken now... nothing works can not build to android.. tried everything :(
     
  8. skad

    skad

    Joined:
    Nov 22, 2013
    Posts:
    15
    Is there a chance that fix will be ported to Linux Editor ?
     
  9. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,071
    @skad what are your issues with the Linux Editor?
    I'm not sure about the state of Android SDK tools for Linux, but the fixes on the Unity side are definitely going to all Editor platforms.
     
  10. Gr8fulGamer

    Gr8fulGamer

    Joined:
    Apr 9, 2017
    Posts:
    2
    5.6.0p4 is not on the patch release page.. i am now having the manifmerger issue since i updated to 5.6.0p3 . i updated to 5.6 because i was getting the cant find sdk issue after android studio updated. i started my project in 5.5 and after android studio updated i could no longer build my project i saw on this forum that there was a fix in 5.6 so i updated and now there is a whole new problem with the manifestmerger. i have tryed everything from dozens of forums and nothing works. i have hundreds of hours invested in this project and now i cant get it to work in any version of unity from 5.5 to 5.6.0p3 i saw in this forum that the manifest merger was fixed in 5.6.0p4 but that is not available on the unity patch release page??? someone please help!!!!
     
  11. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,071
    manifmerger is another tool which was updated without backward compatibility by Google. Please wait for 5.6.0p4 and give it a try - should be out within a week.
     
  12. skad

    skad

    Joined:
    Nov 22, 2013
    Posts:
    15
    Well i will wait for the p4 into linux editor.
    My issues is that i can't build android apk since android update (the same as this issue) and the linux editor is still 5.6.0f3
     
  13. davtam

    davtam

    Joined:
    Nov 27, 2016
    Posts:
    2
    I tried the same process in my end with the SDK tools not SDK build tools and none of the android studio tools versions provided seemed to work even replacing the tools as suggested in other post with the one available through: https://developer.android.com/studio/index.html#downloads.

    The only way I got it to work was by finding "tools_r25.2.2-linux.zip" (through a third party since I could not find access to it through the main developer) and replacing the tools version with that one.

    Hope that helps!
     
  14. agiro

    agiro

    Joined:
    Jan 3, 2016
    Posts:
    193
    @Yury-Habets I'm using Unity 2017.3 (latest stable), latest android studio with tools downgraded and though it starts the build, I get this error:

    Failed to compile resources with the following parameters:
    -bootclasspath "C:/Users/agoston/AppData/Local/Android/Sdk\platforms\android-27\android.jar" -d "C:\Users\agoston\Documents\ZombieRunner2D\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "android\support\compat\R.java" "android\support\coreui\R.java" "android\support\coreutils\R.java" "android\support\fragment\R.java" "android\support\mediacompat\R.java" "android\support\v4\R.java" "com\agirogames\finsnightmare\R.java" "com\google\android\gms\R.java" "com\google\android\gms\ads\R.java" "com\google\android\gms\ads\impl\R.java" "com\google\android\gms\base\R.java" "com\google\android\gms\clearcut\R.java" "com\google\android\gms\gass\R.java" "com\google\android\gms\safetynet\R.java" "com\google\android\gms\tasks\R.java" "com\google\unity\ads\R.java"
    warning: [options] source value 1.6 is obsolete and will be removed in a future release
    warning: [options] target value 1.6 is obsolete and will be removed in a future release
    warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    3 warnings

    I have java sdk 9 (latest too) installed, and I did set the environmental variable. Still, I fail to build with the error I gave.
    Could you lend a hand?
     
  15. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,071
    The warnings shouldn't fail the build - there may be more info afterwards.
     
  16. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    375
    This is the combination that causes your issues. Please use jdk8 instead.

    Just to make things clear: If you are using one of the latest Unity versions (in 5.6, 2017.1, 2017.2 or 2017.3 major version lines) you don't need to downgrade or do any other magic to your android sdk. Issues mentioned at the beginning of this thread were fixed a long time ago. jdk9 however still causes issues and you should continue using jdk8 instead.
     
  17. sulanhava

    sulanhava

    Joined:
    Mar 4, 2018
    Posts:
    4
    Nothing works, i use jdk8. Uninstall Android Studio and reinstall, also uninstall and reinstall Unity.

    Cant build for android and i was going to upload my first app. Well wasted my time with Unity i gues.
     
  18. gv

    gv

    Joined:
    Feb 22, 2013
    Posts:
    89
    This is not true... I downloaded and installed both 2017.3 and the new 2018 version and Android does not work....
     
  19. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    375
    What is the exact error that you get? Do you have jdk9 or jdk10 installed? What are the exact versions of android sdk tools, build tools, platform tools and what platforms do you have installed in your android sdk?