WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 35
This Android Gradle plugin (7.4.2) was tested up to compileSdk = 33
This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=35
to this project's gradle.properties
The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 35
I would like to know where to check my current AGP version and how to update it.
Unity doesn’t usually do major Gradle updates in patch releases and also always lags a bit behind for new major/minor releases as well.
Which means you’ll constantly see this warning and just have to ignore it. It’s only a recommendation and not an issue by itself.
For Unity 2022.3, Android Gradle plugin 7.4.2 is the recommended version:
You could try to replace the Gradle version Unity is using but that would be unsupported. If you don’t have a specific need, I’d stick with Unity’s recommended version.
I try update Unity’s recommended version and newer version(8.2) and build, but it always popup error:
Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'. See the Console for details.
and throw:
> Configure project :launcher
WARNING:The option setting 'android.aapt2FromMavenOverride=C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\35.0.0\aapt2.exe' is experimental.
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 35
This Android Gradle plugin (7.4.2) was tested up to compileSdk = 33
This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=35
to this project's gradle.properties
The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 35
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\34.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-34\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-35\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\34.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-34\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-35\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.53f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :launcher:preBuild UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:generateReleaseBuildConfig
> Task :launcher:generateReleaseResValues
> Task :launcher:javaPreCompileRelease
> Task :launcher:createReleaseCompatibleScreenManifests
> Task :launcher:extractProguardFiles
> Task :launcher:mergeReleaseJniLibFolders
> Task :unityLibrary:mergeReleaseJniLibFolders
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues
> Task :unityLibrary:extractDeepLinksForAarRelease UP-TO-DATE
> Task :unityLibrary:generateReleaseBuildConfig
> Task :unityLibrary:generateReleaseResources
> Task :launcher:checkReleaseDuplicateClasses
> Task :unityLibrary:packageReleaseResources
> Task :unityLibrary:javaPreCompileRelease
> Task :unityLibrary:mergeReleaseShaders
> Task :unityLibrary:compileReleaseShaders NO-SOURCE
> Task :unityLibrary:generateReleaseAssets UP-TO-DATE
> Task :launcher:mergeReleaseShaders
> Task :launcher:compileReleaseShaders NO-SOURCE
> Task :launcher:generateReleaseAssets UP-TO-DATE
> Task :launcher:processReleaseJavaRes NO-SOURCE
> Task :unityLibrary:parseReleaseLocalResources
> Task :unityLibrary:processReleaseManifest
> Task :launcher:collectReleaseDependencies
> Task :unityLibrary:mergeReleaseNativeLibs
> Task :launcher:sdkReleaseDependencyData
> Task :launcher:validateSigningRelease
> Task :launcher:writeReleaseAppMetadata
> Task :launcher:writeReleaseSigningConfigVersions
> Task :launcher:desugarReleaseFileDependencies
> Task :unityLibrary:packageReleaseAssets
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
> Task :unityLibrary:prepareReleaseArtProfile UP-TO-DATE
> Task :unityLibrary:processReleaseJavaRes
> Task :unityLibrary:generateReleaseRFile
> Task :unityLibrary:writeReleaseAarMetadata
> Task :unityLibrary:stripReleaseDebugSymbols
> Task :unityLibrary:mergeReleaseJavaResource
> Task :launcher:mergeExtDexRelease FAILED
> Task :unityLibrary:extractReleaseAnnotations
34 actionable tasks: 31 executed, 3 up-to-date
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
ERROR:D8: com.android.tools.r8.kotlin.H
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:mergeExtDexRelease'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
> Failed to transform retrofit2-1.0.4.jar (com.taptap.sdk:retrofit2:1.0.4) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=false, dexing-min-sdk=22, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
> Execution failed for DexingWithClasspathTransform: C:\Users\26347\.gradle\caches\transforms-3\2d4eb8b3a4e5bbb9cd2f2b296757cf6a\transformed\jetified-retrofit2-1.0.4.jar.
> Error while dexing.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
yes, it said “use a newer Android Gradle Plugin that has been tested with compileSdk = 35”, but I’ve spent hours dealing with this error and don’t know how to upgrade the Android Gradle plugin to fix it
Don’t update the Gradle plugin then. It’s normal to use an old Gradle version with Unity, seeing this message is expected and nothing to worry about. Use the built-in version recommended by Unity.
Unless something else is forcing you to upgrade Gradle, e.g. if a third-party library you use has given you clear instructions to upgrade Gradle and how to do so, there is no reason to do so.
This is only a warning and will not fail your build. If your build is failing, there will be another error you need to look for.
Here’s a pile of notes, including notes on getting SDK35 running and also Gradle-y stuff. Android is one of the most finicky and particular targets to get working, and it only gets worse the more third party stuff you try to integrate, so as Adrian says, keep after it until you find a combination that works.
Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022 (edited on August 23, 2023 to include Android SDK 33…) (and again for SDK34):
Android Gradle errors and other related stuff:
Android SDK35 stuff:
How to troubleshoot build failures:
Obviously, if there is actionable data, clues or information within any of the errors, fix those problems. Each error entry may have more information than can fit in the console log so select each error and read the expanded view below it.
If that gives you nothing worthwhile (look to Google! You’re never the first one!), then…
First, make a blank project with a single blank scene and prove that it builds successfully.
If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.
Until you can build a blank project to the target platform, don’t fiddle with anything else.
Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.
Most often things that prevent building are misconfigured or incorrectly-installed or incompatible third-party libraries such as Firebase or AdMob or IronSource.
Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.
It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.
Android build not building:
Circa July 2022 here have been reports of Unity’s installer failing to install the Android Tools.