Can't build for Android 15 in Unity 2021.3/2022.3

MacOS Unity 2023.2.12f1, getting the same issues trying to build.

Execution failed for task ‘:launcher:bundleReleaseResources’.

A failure occurred while executing com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable
Android resource linking failed
aapt2 E 08-29 21:00:26 10710 155519 LoadedArsc.cpp:94] RES_TABLE_TYPE_TYPE entry offsets overlap actual entry data.
aapt2 E 08-29 21:00:26 10710 155519 ApkAssets.cpp:149] Failed to load resources table in APK ‘/Applications/Unity/Hub/Editor/2023.2.12f1/PlaybackEngines/AndroidPlayer/SDK/platforms/android-35/android.jar’.
error: failed to load include path /Applications/Unity/Hub/Editor/2023.2.12f1/PlaybackEngines/AndroidPlayer/SDK/platforms/android-35/android.jar.

2023.2.12f1 is not a supported version of Unity, and therefore does not support the latest SDK 35. Please, upgrade to 2021.3.44f1+ (released next week), 2022.3.44f1+ or Unity-6 if need to build for SDK 35.

Solved my issues and i’m able to use Unity 6. Thank you.

I’m getting the same errors building for API level 35 on Unity 2022.3.20.
Are you saying moving to 2022.3.44 is necessary? Or will the fix be backported in through the build tools?

Unfortunately yes, the issue was fixed in 2021.3.44 and 2022.3.44. However, there is a workaround explained in the issue tracker description:

  1. Open Android Studio → Download Android SDK Build-Tools 35
  2. In Unity → Open file gradleTemplate.properties (Player Settings → Publish Settings → Check Custom Gradle Properties Template)
  3. Add at the end of the line (note: depending on the Android Studio SDK path on your computer, edit accordingly):

ADDITIONAL_PROPERTIES
android.aapt2FromMavenOverride=<SDK_LOCATION>/build-tools/35.0.0/aapt2.exe