Hi I recently have been attempting to add Android API 35 support to my game. I was building successfully with API version 34.
-
My unity version is 2022.3.22f1, and I needed to upgrade my gradle to be compatible with the new SDK for API version 35. I have done very little with gradle in the past.
-
I used Android sdkmanager command line tool to download SDK 35 from android and I pointed my project to use it in Preferences>External Tools
-
I downloaded gradle version 8.2 and informed Unity to use that path instead of the default, also in Preferences>External Tools
-
I think I am close but I am missing something important related to the gradle files.
This is the error I am getting:
CommandInvokationFailure: Gradle build failed.
V:\2022.3.22f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "V:\gradle\gradle-8.2-all\gradle-8.2\lib\gradle-launcher-8.2.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':launcher:lintVitalReportRelease'.
> Could not create task ':launcher:processReleaseMainManifest'.
> Cannot use @TaskAction annotation on method IncrementalTask.taskAction$gradle_core() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
* 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 1s
]
stdout[
> Configure project :launcher
WARNING:The option setting 'android.aapt2FromMavenOverride=V:2022.3.22f1EditorDataPlaybackEnginesAndroidPlayerSDK_newbuild-tools35.0.0aapt2.exe' is experimental.
> Configure project :unityLibrary
Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'unityLibrary\build.gradle'
Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'unityLibrary\build.gradle'
Build was configured to prefer settings repositories over project repositories but repository 'flatDir' was added by build file 'unityLibrary\build.gradle'
WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
> Configure project :unityLibrary:IronSource.androidlib
WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1a9338a70cd64c718bc2b14b3805c8e8>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1a9338a70cd64c718bc2b14b3805c8e8>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <1a9338a70cd64c718bc2b14b3805c8e8>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <1a9338a70cd64c718bc2b14b3805c8e8>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <1a9338a70cd64c718bc2b14b3805c8e8>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at <1a9338a70cd64c718bc2b14b3805c8e8>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <1a9338a70cd64c718bc2b14b3805c8e8>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <1a9338a70cd64c718bc2b14b3805c8e8>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
For reference: mainTemplate.gradle
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.0'
}
}
allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
implementation 'com.google.android.gms:play-services-ads-identifier:18.1.0' // Assets/LevelPlay/Editor/IronSourceSDKDependencies.xml:12
implementation 'com.google.android.play:core-common:2.0.4' // Packages/com.google.play.core/Editor/Dependencies.xml:3
implementation 'com.google.android.play:review:2.0.2' // Packages/com.google.play.review/Editor/Dependencies.xml:3
implementation 'com.unity3d.ads:unity-ads:4.13.1' // Assets/LevelPlay/Editor/ISUnityAdsAdapterDependencies.xml:12
implementation 'com.unity3d.ads-mediation:adquality-sdk:7.23.0' // Assets/LevelPlay/Editor/IronSourceAdQualityDependencies.xml:4
implementation 'com.unity3d.ads-mediation:mediation-sdk:8.8.0' // Assets/LevelPlay/Editor/IronSourceSDKDependencies.xml:5
implementation 'com.unity3d.ads-mediation:unityads-adapter:4.3.49' // Assets/LevelPlay/Editor/ISUnityAdsAdapterDependencies.xml:5
// Android Resolver Dependencies End
**DEPS**}
// Android Resolver Exclusions Start
android {
packagingOptions {
exclude ('/lib/armeabi/*' + '*')
exclude ('/lib/mips/*' + '*')
exclude ('/lib/mips64/*' + '*')
exclude ('/lib/x86/*' + '*')
exclude ('/lib/x86_64/*' + '*')
}
}
// Android Resolver Exclusions End
android {
ndkPath "**NDKPATH**"
compileSdkVersion 35
buildToolsVersion '35.0.0'
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion 35
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}**PACKAGING_OPTIONS**
}
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**
For reference: settingsTemplate.gradle
pluginManagement {
repositories {
**ARTIFACTORYREPOSITORY**
gradlePluginPortal()
google()
mavenCentral()
}
}
include ':launcher', ':unityLibrary'
**INCLUDES**
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
**ARTIFACTORYREPOSITORY**
google()
mavenCentral()
// Android Resolver Repos Start
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
maven {
url "https://maven.google.com/" // Assets/LevelPlay/Editor/IronSourceSDKDependencies.xml:12, Assets/LevelPlay/Editor/ISUnityAdsAdapterDependencies.xml:12
}
mavenLocal()
// Android Resolver Repos End
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
}
}
For reference: gradleTemplate.properties
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
unityStreamingAssets=**STREAMING_ASSETS**
# Android Resolver Properties Start
android.useAndroidX=true
android.enableJetifier=true
# Android Resolver Properties End
**ADDITIONAL_PROPERTIES**
android.enableDexingArtifactTransform=false
# New properties for API 35 and AGP 8.1.0
android.suppressUnsupportedCompileSdk=35
android.aapt2FromMavenOverride=V:\2022.3.22f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK_new\build-tools\35.0.0\aapt2.exe
Some build settings:
I appreciate the help in advance, if there are any important debugging details I have failed to include please let me know.
Thank you

