Search Unity

Unity 2018 still has problems listing target platforms?

Discussion in 'Android' started by TitanUnity, Jun 28, 2018.

  1. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Hey guys,

    We recently upgraded from Unity 5.5.2p2 to Unity 2018.1.3f1. For the longest time we had issues building to android where we would see errors like this:
    UnableToList.PNG

    The solution was always this odd fix to install downgraded SDK tools here:
    http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip

    We assumed that this issue was something specific to our old build but it seems this is still an issue in 2018? Can anyone shed some light on this? Are we doing something wrong or is this really still an issue?

    I noticed in the SDK manager there are several new versions of the Build-Tools well ahead of 25.2.5 but if we try any of them our game won't build.

    Here are a few specific questions we could really use some clarity on:
    1. Do we really need to downgrade the tools to 25.2.5 or is there another work around to fix this issue?

    2. How do each of these different packages found in the Android Studio > Android SDK manager impact builds in Unity? It seems like we can use a current API level like Oreo (API Level 27), but the Build Tools need to be downgraded or Unity won't publish. Each of these components seems to have a different version number and it's unclear exactly how they impact our builds within Unity, we could really use some clarity on these:
    - Android API
    - Android SDK Build-Tools (which opens to show many versions inside)
    - Android SDK Platform-Tools
    - Android SDK Tools


    API.PNG

    Relationship1.PNG

    Here is Android SDK Build-Tools 28 expanded:
    Installed1.PNG
     
    Last edited: Jun 28, 2018
  2. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    In addition to having to downgrade the Android SDK Build-Tools to 25.2.5... it seems like in Unity 2018 the adaptive icon window isn't recognizing that we do have a modern Android API installed. As you can see we receive these icon warnings even after installing API levels 26, 27 + 28.

    Any help understanding whats up here would be super helpful, thank you!
     
  3. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    Is there any plan to support the new version of Android SDK Tool for unity?
     
  4. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    @TitanUnity you should copy-paste error / warning messages instead of just saying that you get them. They contain information which helps to identify the issue. Without them I can only guess what's wrong.
    To begin with, latest Android SDK Tools should work fine with Unity 2018.1 and no replacing / moving around / downgrading workarounds are needed. The only exception might be release candidate tools versions (I don't remember if they work with Unity 2018.1 or not), but officially released versions should work. Maybe you have jdk9 or jdk10 installed on your machine, which prevents you from using the latest Android SDK Tools. Make sure you have installed only jdk8.
    For the adaptive icons warning, if you have target api level set to automatic or 26+ then it's likely an old tools version that causes the warning. First solve the issue which prevents you to use the latest android sdk tools, then double check what target api level is selected in the player settings.
     
  5. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    You have to ask more specifically. All currently available Android SDK Tools work for me with the latest Unity version, so the answer to this question is "yes".
     
  6. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Hmmm, my intention was to include a screenshot there, not sure what happened in the upload, but here is the warning regarding adaptive icons, (I assume you can see my other screenshots?)
    AndroidError.PNG
    I have API Level 27 currently installed, so this makes no sense

    And yes I have jdk8 installed
    Jdk.PNG

    I've tried tons of combinations and none of them work unless I download the old build tools 25.2.5.
    This has been a confirmed issue in the past:
    https://issuetracker.unity3d.com/is...-android-sdk-tools-25-dot-3-1-version-is-used

    Still receiving same error message:
    "Unable to list target platforms..."
     
    dinindu_unity likes this.
  7. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Are you experiencing the same problem when attempting to build with the latest SDK tools?
     
  8. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Yes, I can see your screenshots. Could you check what you have selected in the Player Settings -> Target API Level?

    Ok, it's good that you have it installed and selected inside the editor, however if a newer java is installed on your machine as well, then android tools could pick it up instead and fail. The easiest solution is to uninstall jdk9 and / or jdk10 if they are installed.

    Yes, it had the same headline of the error message meaning that we are not able to properly use android sdk tools and something is wrong. However previously the actual cause of that issue was very different.
     
    DBarlok likes this.
  9. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Interestingly, I uninstalled jdk9 (which was installed on my computer but was not referenced by Unity) and the builds now work. To be clear, the Unity Preferences > External Tools > JDK value was set to use jdk 1.8 the entire time... not sure why this worked, but thanks.
     
  10. Peru_Tuning

    Peru_Tuning

    Joined:
    Mar 9, 2019
    Posts:
    2
    Hello,

    I found this thread because of the "Required API level 26" error too, and it's getting annoying... I'll post some info below so if anyone is looking to find an answer can compare situations and figure out the solution

    This is the initial error https://ibb.co/BPfrhb7, and when I click on, and when I click on update Android SDK, it shows me a message that says "Unable to install additional SDK platform. Please make the SDK manager manually to make sure you have the latest set of tools...."

    Also, selected the Target API Level under "Other Settings" to be the correspondent https://ibb.co/Ypg3nfq nevertheless, when I tried to build the APK for testing, it still shows me the initial message.

    Then I tried the old solution of replacing the existing tools file with the "tools_r25.2.5-windows" package, but when I try to build with that file replaced within the skd file it shows a message saying thet the "Android SDK is Outdated" https://ibb.co/QYJXkCZ

    So now am kind of confused, but when checking on my console error I get this as the error:

    UnityException: Required API level 26.
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (UnityEditor.Android.AndroidJavaTools javaTools, System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector detector) (at <df7ba4d130594d168eec372b930522d4>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (UnityEditor.Android.AndroidJavaTools javaTools, System.Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector detector) (at <df7ba4d130594d168eec372b930522d4>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <df7ba4d130594d168eec372b930522d4>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <df7ba4d130594d168eec372b930522d4>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at <df7ba4d130594d168eec372b930522d4>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at <df7ba4d130594d168eec372b930522d4>:0)
    UnityEditor.PostprocessBuildPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:106)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    I checked Android Studio I made sure that the API 26 was installed, and in theory is there but when trying to use Unity with the available tools it keeps showing an error https://ibb.co/hBg0XZg

    Any suggestions to solve this would be appreciated.
     
  11. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Which Unity version do you use? Double check the sdk path. Make sure that the android sdk path set in Unity editor is the same as the one set in Android Studio.
     
    Peru_Tuning likes this.
  12. Peru_Tuning

    Peru_Tuning

    Joined:
    Mar 9, 2019
    Posts:
    2
    Hi, @JuliusM

    I'm using Unity 2018.3.8f1, within the External Tools sections I kept selected the "Use Embedded JDK" option, because when I tried to used the path to the C: installation I got another error. So was I did was trying to use the unity SDK that comes with the package, then it asked me to use API level 26 and I download that version through the SDK manager.

    After that I tried to build but it shown me an error saying "sdk tools is outdated version 0.0.0 < 23.0.0", so I decided the use a legacy tooks pack downloaded from the net and replace that pack into the sdk file. Then I tried to build again and I'm having the "Failed sign to SDK" again...

    So in summary, if I used the C path to the SDK it creates an error and if I select using the embedded SKD version it also creaste and error.... However I checked errors console and it shows a warning saying:

    "Failed getting available Android API levels. Make sure your android sdk tools version is 25 or higher and you have internet connection."

    Of couse I have internet connection, but looks like there's some kind of trouble in the communication between the SDK Tools and the keystore or something like that... here are the errors I'm having
     
  13. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Ok, so you are getting many different errors which are caused by different things. Not all of them are related to SDK. First of all, please don't replace any part of the SDK with parts from previous SDK versions. We have never suggested to do that as a workaround and that is a bad solution.
    Android SDK has 4 components: tools, build-tools, platform-tools and platforms. In your SDK manager make sure that you have latest versions of tools, build-tools and platform-tools installed. Then depending on the needed API level, make sure that you have a platform with that version installed as well. After that make sure that the path specified in the SDK manager is also set in Unity editor (don't select "Use Embedded SDK"). After setting a path to the SDK you can restart Unity editor (this is not needed, but you can do that just in case). Now try to build. If you get an error, make sure your computer does not have java 9, java 10 or java 11 installed. If any of these versions are installed, uninstall them. After that if you will still get an error, it's likely the error is not related to Android SDK or JDK. Paste the error(s) here.
     
  14. sjgghosh2809

    sjgghosh2809

    Joined:
    Mar 25, 2019
    Posts:
    1
    pls help .....i have uninstalled jdk 11.....but still getting this error...target api set on 28

    CommandInvokationFailure: Gradle build failed.
    C:/Program Files/Java/jdk1.8.0_191\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

    stderr[

    FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring root project 'gradleOut'.
    > Failed to find Build Tools revision 29.0.0

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 10s
    ]
    stdout[

    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <e1c3953b4cf040ddb1400046b1c34897>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  15. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    You are probably running into another known issue. Gradle build doesn't work with a release candidate versions of the build tools for now. You should uninstall RC version and install the latest released build tools version instead. If you have multiple build tools versions installed, then alternatively you can just remove the "29.0.0-rc1" folder from the build tools directory (in the SDK location).
     
  16. tsatellite2000

    tsatellite2000

    Joined:
    Jan 10, 2019
    Posts:
    4
    Build settings -> player settings -> other settings -> in target API level I selected the highest. It was't selected the highest. This solved the problem for me
     
  17. raptgamesstudio

    raptgamesstudio

    Joined:
    Sep 3, 2019
    Posts:
    8
    Hi can any one help me ?

    I am using Unity 2019.2.0f1 and jk 8, the problem is that, during build this error comes that sdk tools version
    25.2.5 < 26.1.1 which is in my screenshot _1. when i go to my sdk manager there i see only sdk tools version 25.2.5 and nothing about 26.1.1 which is in my screenshot_2 while my build settings are in screenshot_3.

    kindly help to solve this problem.

    thanks.
     

    Attached Files:

  18. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    You are using too old SDK version, which can't be upgraded to a newer version. You can download the correct SDK version from the hub, see this link for more information: https://docs.unity3d.com/2019.2/Documentation/Manual/android-sdksetup.html. Also note that the sdk manager was removed in later SDK versions, so you will have to use Android Studio if you'll want to have similar UI to what you see in your second screenshot.
     
    raptgamesstudio likes this.
  19. raptgamesstudio

    raptgamesstudio

    Joined:
    Sep 3, 2019
    Posts:
    8
    thanks JuliusM,
    i am very thankfull to you. my problem is solved becouse of you. again thanks
     
    JuliusM likes this.
  20. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    I have been searching for this all over the unity forums and unity answers but could not find an explanation to this warning. Can any one explain this to me?

    I am getting this warning in Unity. I am testing the game on Android API 28 and it is working fine but still I am not sure if this is some thing to worry. I am setting Minimum API Level to 16 and Maximum to "Automatic Highest Installed" and I am having API 16 to API 29 installed in SDK Manager in Android Studio tools. Also I am having internet connection active. I am using Unity 2018.4.10f1

    "Failed getting available Android API levels. Make sure your android sdk tools version is 25 or higher and you have internet connection."

    I tried various things but no success.
     
  21. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    Could you try to use a newer version of Unity 2018.4LTS? There were improvements related to this made in 2018.4.18f1, but I would suggest to use the latest LTS version anyway.
     
  22. WaqasGameDev

    WaqasGameDev

    Joined:
    Apr 17, 2020
    Posts:
    118
    Thanks JuliusM. I tried using 2018.4.23f1 LTS which is latest available 2018LTS version under unity hub. But still I got the same error. I tried opening different projects in 2018 different versions but same issue persists. I have SDK platforms from API 16 to API 30 and SDK build tools also from 16 to 30 in SDK manager. However After setting Minimum API Level to API 19, I don't get this warning all the time. I now get only few and far between along with below error some times.

    "IndexOutOfRangeException: Index was outside the bounds of the array. UnityEditor.Android.AndroidBuildWindowExtension.GetBuildPlayerWindow () (at <df45ca7b334d4b918976307f9d26db2e>:0) UnityEditor.Android.AndroidBuildWindowExtension.RepaintTargetList () (at <df45ca7b334d4b918976307f9d26db2e>:0) UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:200)"

    But my apk runs perfect on API 28 I am testing against. If my apk is not causing problem to me, then are these warnings and errors something to worry?
     
  23. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
    If you are able to build and the application runs on your device, then it should be fine. One thing that I would suggest to double-check is the target API level in the built apk (you can inspect the apk in Android Studio). If that is what you expect it to be, then you could ignore this warning.
    One more thing came to my mind, did you install "Android SDK Tools" component in SDK? You could see the guide here https://docs.unity3d.com/2018.4/Documentation/Manual/android-sdksetup.html ("1b. Install the SDK using Android Studio" section).