Search Unity

Quickfix to build with Target Api Level 29

Discussion in 'Android' started by Ricks, Jul 25, 2020.

  1. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
    So I couldn't build my Android project with Target Api Level 29 because "Update Android SDK" failed (Unity 2019.4.3f1), but found a solution and thought I post it.

    The original solution comes from here: https://stackoverflow.com/questions/54010590/unity-build-failure-unable-to-update-the-sdk. Besides I don't have Android Studio or any Java version installed, except what Unity installed (which is the Android module with OpenJDK).


    Summarized steps: (adjust all paths to your case)

    1) Create an empty "repositories.cfg" file in C:\Users\YourUserName\.android\

    2) Open the Command Line (CMD) and enter:
    "C:\Program Files\Unity\Hub\Editor\2019.4.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat" "platforms;android-29"

    If warnings appear that JAVA and JAVA_HOME aren't found, you have to set the Environment Variables in your System:

    Add this to the PATH variable:
    C:\Program Files\Unity\Hub\Editor\2019.4.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin

    Create new JAVA_HOME variable with this value:
    C:\Program Files\Unity\Hub\Editor\2019.4.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK

    When trying the command again and the download stops at 10%, you have to run it with admin rights. Rightclick the CMD before opening and "Run as Admin", then try again.


    Now it downloads successfully, Unity Project builds with Target Api Level 29, no complaints from Playstore anymore.
     
    Last edited: Jul 25, 2020
    man-teiv, trirom1, omar_5 and 5 others like this.
  2. HectorOfPriamos

    HectorOfPriamos

    Joined:
    Jul 9, 2017
    Posts:
    15
    Mate thanks for sharing that solution! I have been searching for it such a long time, too many solutions but none of them worked for me. This one worked perfectly fine with no surprises! :)
     
  3. sajalmahato

    sajalmahato

    Joined:
    Jul 28, 2020
    Posts:
    1
    From this method the application is build successfully but the app is not working on my smartphone Samsung Galaxy S7, Shows 'App Name has stopped'.
    Please help.
     
  4. Baymobile

    Baymobile

    Joined:
    Feb 16, 2020
    Posts:
    2
    Can anyone solve the problem?
     
  5. LAKSHAYMAVIA

    LAKSHAYMAVIA

    Joined:
    Aug 28, 2018
    Posts:
    27
    Thank you so much. Updated the sdk to android -29
     
  6. ngoanrazor

    ngoanrazor

    Joined:
    Aug 19, 2020
    Posts:
    1
    Thanks, it woriking with CMD (Admin)
     
  7. saltysquid

    saltysquid

    Joined:
    May 1, 2017
    Posts:
    41
    This worked perfectly for me as well - thank you!
     
  8. HamidDjavadi

    HamidDjavadi

    Joined:
    Sep 21, 2020
    Posts:
    2
    Worked pefectly! Thanks a lot!