Quickfix to build with Target Api Level 29

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: android - Unity: Build failure, unable to update the SDK - Stack Overflow. 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.

8 Likes

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! :slight_smile:

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.

Can anyone solve the problem?

Thank you so much. Updated the sdk to android -29

Thanks, it woriking with CMD (Admin)

This worked perfectly for me as well - thank you!

Worked pefectly! Thanks a lot!