Search Unity

Failed to update Android SDK Package List - Unity 2019.2.10f1

Discussion in 'Android' started by siddharth3322, Apr 16, 2020.

  1. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    When I try to export the game build for the Android platform, I started getting this error:

    failed to load android sdk.png

    Within the Project Settings - Minimum API Level and Target API Level not get loaded anyhow! While I have used all default Unity provided settings to export Android build. Here is the image to illustrate this:

    unity android sdk problem.png
    Now what to do to solve this error?

    I have already read all the threads related to the same problem but overall I can't able to find the solution that actually worked for me.
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    siddharth3322 likes this.
  3. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Thank you for your quick reply :)
    I have tried to follow the given answer at my best but still, I can't able to get success.
    I want to share screenshots after applying the solution what happened with me:
    sdkmanager script updated screenshot:
    sdkmanager script edited.png

    In the last point, the person said to run the command but this is happening to me:
    execute command terminal.png

    I am noob in executing commands in Terminal so I don't know what is going wrong!!
    So please suggest me further into this.

    I have just downloaded all things from the Unity HUB then also this kind of problem occurring that I can't able to understand.

    NOTE: Recently I have upgraded my Java SE, maybe then after problem get started:
    java upgraded.png
     
    Last edited: Apr 17, 2020
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    Did you try simply uninstalling the system JDK? And reverting back to JDK 8
     
    siddharth3322 likes this.
  5. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Do you suggest me to remove this version?

    jdk 13 version.png

    I have started downloading JDK 8 version:
    jdk 8 version.png

    I hope after I remove JDK 13, it will not start creating a problem for other Unity versions.
    Because other 2 Unity versions working properly at present :)
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    Which Unity versions are you referring to? if you want to be on the safe side, just have JDK 8 installed.
     
  7. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    At present, I was using these Unity versions:
    unity version - hub.png
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
  9. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    I have installed JDK 8 into my computer and restart it too.

    jdk 8 installed.png


    But still, the problem is not solved :(
    unity library linking.png

    Library and SDK linked to all default places.
     
  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    when you open terminal and do
    java -version

    what does it say?
     
  11. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    This is the result:
    java version.png
     
  12. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    Hmph, well a long shot, but you could try downloading Android Studio, and see if you can build to Android from there.

    If yes, in Android Studio change SDK path to point to the on Unity installation path, and try building to Android again
     
    siddharth3322 likes this.
  13. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Thank you to remain with me in my this problem :)
    I have already in my system Android Studio exist with this kind of SDK and other packages download:

    android sdk platforms.png

    android sdk tools.png

    Now Unity can't able to accept this Android Studio SDK and the overall situation remain the same.
    android sdk tool linking.png
     
  14. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    I mean the other way around, change Android SDK path in Android Studio to point to the one Unity has in its installation path
     
    siddharth3322 likes this.
  15. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Okay, I have performed the reverse step and try to link Unity SDK with Android Studio.
    This is the first step after linking:
    after SDK linking.png

    There is some installation required so I have completed that:
    SDK setup complete after installation .png

    So this is the situation after Android Studio linking:
    unity sdk android studio linking.png

    What is the next step I require to do?
     
  16. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    Select API Level 28, and install it, currently it says it's Partially installed, which is incorrect
     
    siddharth3322 likes this.
  17. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Yes sir, now API get linked with the SDK successfully and on the spot, library gets loaded in the Unity Project Settings:

    android api level.png

    Exactly what is the problem?
    Partial SDK or wrong JDK version...
     
  18. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    I would guess something with your OS wrong, maybe as soon as you installed newest JDK, it did something... but can't be sure what.

    Glad it works for you now
     
    siddharth3322 likes this.
  19. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Again I started getting the same error:

    failed to update android package list.png

    Please check this if you can able to help me.
     
  20. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    Could you please do this

    Create NewBehaviourScript.cs, attach it to some GameObject and run
    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class NewBehaviourScript : MonoBehaviour
    7. {
    8.     // Start is called before the first frame update
    9.     void Start()
    10.     {
    11.        
    12.     }
    13.  
    14.     // Update is called once per frame
    15.     void Update()
    16.     {
    17.        
    18.     }
    19.  
    20.     private void OnGUI()
    21.     {
    22.         GUILayout.Label(Environment.GetEnvironmentVariable("JAVA_HOME"));
    23.     }
    24. }
    25.  
    I think your JAVA_HOME env variable is incorrect, it should point to OpenJDK inside Unity.
     
    siddharth3322 likes this.
  21. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    p.s it seems other people had this issue too, updating to 2019.2.11f1 fixed that for them
     
    siddharth3322 likes this.
  22. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    At present, I was running Unity 2019.2.10f1 so if I upgrade to Unity 2019.2.11f problem will get solved?

    JAVA_HOME variable returning me empty strings, I have tried these both approaches to get the data:

    Code (CSharp):
    1. private void OnGUI()
    2.     {
    3.         guiStyle.fontSize = 200;
    4.         GUILayout.Label(Environment.GetEnvironmentVariable("JAVA_HOME"), guiStyle);
    5.     }
    Code (CSharp):
    1. Debug.Log("Java Home: " + Environment.GetEnvironmentVariable("JAVA_HOME"));
    Both giving me empty strings in the result.
     
  23. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    Yes, that's wrong, it should point to JDK directory you have set in Player Preferences. Assuming you have it set? If so, then yes, try upgrading to 2019.2.11, backup your project just in case.
     
    siddharth3322 likes this.
  24. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
  25. skdev3

    skdev3

    Joined:
    Jul 15, 2015
    Posts:
    64
    How To Use Update Android SDK in Windows.
    1. Save this code to sdk.cmd.
    2. Modify UNITY_VERSION
    3. Add or change the SDK you need: platforms;android-XX
    4. Run sdk.cmd as Administrator.
    Code (CSharp):
    1. set UNITY_VERSION=2020.1.8f1
    2.  
    3. c:
    4. set JAVA_HOME=c:\Program Files\Unity\Hub\Editor\%UNITY_VERSION%\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\
    5. set ANDROID_HOME=c:\Program Files\Unity\Hub\Editor\%UNITY_VERSION%\Editor\Data\PlaybackEngines\AndroidPlayer\
    6. cd %ANDROID_HOME%SDK\tools\bin\
    7. echo.> %USERPROFILE%\.android\repositories.cfg
    8.  
    9. cmd /C sdkmanager --update
    10. cmd /C sdkmanager "platform-tools" "platforms;android-29"
    11. cmd /C sdkmanager "platform-tools" "platforms;android-30"
    12. cmd /C sdkmanager "platform-tools" "platforms;android-31"
    13.