Unity 2020 cannot update android APK to API level 29

Viewed 11482

EDIT: I don't have enough karma or whatever to comment, but I fixed this by downloading the most recent apk using the android apk app. This allowed me to specify the download location as the unity apk path

=============================================================

When I try to build my game for android API target level 29, I get this error:

"Unable to install additional SDK platform. Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed. See the Console for details"

This is the console output when I manually run the sdk manager:

"C:\Program Files\Unity\Hub\Editor\2020.1.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat" "platforms;android-29"
Warning: File C:\Users\zande\.android\repositories.cfg could not be loaded.
License android-sdk-license:            ] 10% Computing updates... 
---------------------------------------
<entire android terms and conditions document is printed>
---------------------------------------
Accept? (y/N): y
Warning: Failed to read or create install properties file.
[===                                    ] 10% Installing Android SDK Platform 30

It looks like my currently installed version targets API level 28, which google play does not allow me to publish with. I am using unity 2020.1f1, and have tried everything. What is going on?

5 Answers

This is a known issue as of now: Official Unity forum

However, I did not follow their solutions and ended up copying the android 29 SDK manually from the android studio sdk directory into the Unity sdk directory:

1) Make sure you have the android 29 SDK:

Open Android Studio. After the splash screen has loaded, select the Configure button (bottom right, next to gear icon) and from the dropdown select SDK Manager and in the list make sure Android 10 (API 29) is checked, if it isn't check it and apply to download the SDK.

2) Get the path to the Android SDK directory

From the same window, note the path in the text field labeled Android SDK Location

3) Get the path to Unity's Android SDK directory

In Unity, click Edit => Preferences => External Tools. Scroll down and find a list of text fields with paths under the Android label. Note the path location in the field labeled Android SDK Tools Installed with Unity (recommended)

4) Copy the Android Studio SDK to Unity

Navigate to both paths in explorer. In each there will be a folder called 'platforms'. Go into this folder from the Android SDK path and copy the android-29 folder to the platforms folder in the Unity path.

Run the command shell with elevated access, or create a batch file that calls the first batch with the parameter, and then right-click the new batch file and choose "Run as administrator". The real error is that it can't create the install properties file because it doesn't have write access.

i ve this problem too try it first sdkmanager "platform-tools" then sdkmanager "platforms;android-29" maybe this will help you.

I also had this problem, I was using the unity version 2019.4.0f1.

Run Unity Hub as an administrator. Update the target API to 29 in settings. Then build the app as usual. Unity will ask for your permission to update to API 29. Just accept it and you are done.

So this is how it worked out for me.

On Windows, open a cmd-line window as Administrator and execute these commands, replacing 2019.2.21f1 with your version of Unity.

set "JAVA_HOME=C:\Program Files\Unity\Hub\Editor\2019.2.21f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK"
cd "C:\Program Files\Unity\Hub\Editor\2019.2.21f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin"
echo.> %USERPROFILE%\.android\repositories.cfg
sdkmanager.bat "platform-tools" "platforms;android-29"

On mac OS, open a Terminal window, and execute these commands, replacing 2019.2.21f1 with your version of Unity.:

export JAVA_HOME=/Applications/Unity/Hub/Editor/2019.2.21f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/MacOS
cd /Applications/Unity/Hub/Editor/2019.2.21f1/PlaybackEngines/AndroidPlayer/SDK/tools/bin"
touch ~/.android/repositories.cfg
./sdkmanager "platform-tools" "platforms;android-29"
Related