I’m trying to upgrade a project to use Android API 35 and I’m running into problems while building.
It starts with an error message reading
Could not resolve all files for configuration ‘:launcher:releaseRuntimeClasspath’. See the Console for details.
Then in the logs I get the following messages.
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
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:preReleaseBuild UP-TO-DATE
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:compileReleaseAidl NO-SOURCE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:xrmanifest.androidlib:compileReleaseRenderscript NO-SOURCE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:generateReleaseResources UP-TO-DATE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :launcher:extractProguardFiles UP-TO-DATE
> Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:packageReleaseResources UP-TO-DATE
> Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:xrmanifest.androidlib:parseReleaseLocalResources UP-TO-DATE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues
> Task :unityLibrary:extractDeepLinksForAarRelease
> Task :unityLibrary:generateReleaseBuildConfig
> Task :unityLibrary:xrmanifest.androidlib:generateReleaseBuildConfig
> Task :unityLibrary:generateReleaseResources
> Task :unityLibrary:xrmanifest.androidlib:javaPreCompileRelease
> Task :launcher:checkReleaseDuplicateClasses FAILED
> Task :unityLibrary:xrmanifest.androidlib:mergeReleaseJniLibFolders
> Task :unityLibrary:xrmanifest.androidlib:processReleaseManifest
package="com.UnityTechnologies.XR.Manifest" found in source AndroidManifest.xml: C:\Users\yanni\source\repos\VeroverDeStadUnity\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\xrmanifest.androidlib\AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
> Failed to transform support-v4-25.1.0-.aar (:support-v4-25.1.0:) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.status=integration, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\yanni\source\repos\VeroverDeStadUnity\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\libs\support-v4-25.1.0.aar.
> Failed to transform 'C:\Users\yanni\source\repos\VeroverDeStadUnity\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\libs\support-v4-25.1.0.aar' using Jetifier. Reason: AmbiguousStringJetifierException, message: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
This is a known exception, and Jetifier won't be able to jetify this library.
Suggestions:
- If you believe this library doesn't need to be jetified (e.g., if it already supports AndroidX, or if it doesn't use support libraries/AndroidX at all), add android.jetifier.ignorelist = {comma-separated list of regular expressions (or simply names) of the libraries that you don't want to be jetified} to the gradle.properties file.
- If you believe this library needs to be jetified (e.g., if it uses old support libraries and breaks your app if it isn't jetified), contact the library's authors to update this library to support AndroidX and use the supported version once it is released.
If you need further help, please leave a comment at https://issuetracker.google.com/issues/140747218.
* 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 4s
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\2022.3.41f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\2022.3.41f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.5.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
Environment Variables:
AMPLITUDE_API_KEY_REDBUCKET_DEV = 46b8b46515e7632fc42a504b72e05fd0
USERDOMAIN = LAPTOP-GEVBMQQK
ProgramFiles = C:\Program Files
USERPROFILE = C:\Users\yanni
OneDrive = C:\Users\yanni\OneDrive - Tigerlily World of Wonders
PROCESSOR_ARCHITECTURE = AMD64
AMPLITUDE_API_KEY_GREENBUCKET_DEV = 3ded2a762163603391a425f688f990c8
OneDriveConsumer = C:\Users\yanni\OneDrive
OS = Windows_NT
CHROME_CRASHPAD_PIPE_NAME = \\.\pipe\crashpad_23048_LMTAUPVBKNYVUYQE
PROCESSOR_IDENTIFIER = AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD
AMPLITUDE_TOKEN_REDBUCKET_DEV = U4PSN7S7PuYVRODivvdcFwbu8R6IHGqa
PROCESSOR_REVISION = 6001
ProgramW6432 = C:\Program Files
AMPLITUDE_API_KEY_GREENBUCKET_PROD = c86fea37a9e1d3f0878b96e15b111c7c
CommonProgramFiles = C:\Program Files\Common Files
SENTRY_ACCESS_TOKEN = 3df78d9e53f8456aa90fbae044ce1a6261421ab1d0014674bc2e933477289017
JAVA_HOME = C:\Program Files\Unity\2022.3.41f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_DEV = client-wbjHYrmeSR87GmWOE7LDpf7sUySOIKHm
AMPLITUDE_TOKEN_GREENBUCKET_PROD = ZpUcbAdZXJYzNSoHsAWtL_s_JppwWid9
ComSpec = C:\Windows\system32\cmd.exe
AMPLITUDE_API_KEY = 28f3cae0b33b8b3702120c9ed1a935aa
LOGONSERVER = \\LAPTOP-GEVBMQQK
PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
ANDROID_NDK_ROOT = C:\Program Files\Unity\2022.3.41f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK
SystemRoot = C:\Windows
NUMBER_OF_PROCESSORS = 16
WOOTRIC_CLIENT_TOKEN = NPS-aa8be4c3
DEBUG_ENV_VAR = UnityHub
TMP = C:\Users\yanni\AppData\Local\Temp
AMPLITUDE_TOKEN_YELLOWBUCKET_PROD = UYDQtPOw83dIfVy3SrW5oMyo7ru4PRkV
FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer
TEMP = C:\Users\yanni\AppData\Local\Temp
Path = C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Users\yanni\AppData\Local\Android\Sdk\platform-tools\;C:\Gradle\gradle-8.9\bin;C:\Java\jdk-22.0.2\bin;C:\Users\yanni\AppData\Local\Microsoft\WindowsApps;C:\Users\yanni\AppData\Local\GitHubDesktop\bin;C:\Users\yanni\.dotnet\tools
USERNAME = yanni
COMPUTERNAME = LAPTOP-GEVBMQQK
AMPLITUDE_API_KEY_REDBUCKET_PROD = ca12bb461ea96f9bdf5df4ded7d52994
AMPLITUDE_API_KEY_YELLOWBUCKET_PROD = e03a9bbe92dc38a88cdb068d24c65b46
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
OneDriveCommercial = C:\Users\yanni\OneDrive - Tigerlily World of Wonders
ALLUSERSPROFILE = C:\ProgramData
SystemDrive = C:
windir = C:\Windows
AMPLITUDE_TOKEN_REDBUCKET_PROD = jTIgKs5KTZOjiqEEVdZFbgo_VRhABduL
FPS_BROWSER_USER_PROFILE_STRING = Default
AMPLITUDE_TOKEN_GREENBUCKET_DEV = 84H2gMm_FJzhr3mBaX1lM1JVukmCM7d9
AMPLITUDE_API_KEY_STAGING = 83ee04fccc67e4fcc7dd527c4c6f1e21
PUBLIC = C:\Users\Public
CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
APPDATA = C:\Users\yanni\AppData\Roaming
DriverData = C:\Windows\System32\Drivers\DriverData
PROCESSOR_LEVEL = 23
CommonProgramW6432 = C:\Program Files\Common Files
ProgramFiles(x86) = C:\Program Files (x86)
SESSIONNAME = Console
AMPLITUDE_TOKEN_YELLOWBUCKET_DEV = wKi8foVigDditGFvmZewRFWsEbX9Y0YO
AMPLITUDE_API_KEY_YELLOWBUCKET_DEV = 48835b4d1f5e342aefe5f016324d296a
LOCALAPPDATA = C:\Users\yanni\AppData\Local
HOMEPATH = \Users\yanni
ProgramData = C:\ProgramData
HOMEDRIVE = C:
USERDOMAIN_ROAMINGPROFILE = LAPTOP-GEVBMQQK
AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_PROD = client-zH8Y7OK1i331EKuG77C6UxN8ygcM6LzS
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
stderr[
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
> Failed to transform support-v4-25.1.0-.aar (:support-v4-25.1.0:) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.status=integration, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\yanni\source\repos\VeroverDeStadUnity\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\libs\support-v4-25.1.0.aar.
> Failed to transform 'C:\Users\yanni\source\repos\VeroverDeStadUnity\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\libs\support-v4-25.1.0.aar' using Jetifier. Reason: AmbiguousStringJetifierException, message: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
This is a known exception, and Jetifier won't be able to jetify this library.
Suggestions:
- If you believe this library doesn't need to be jetified (e.g., if it already supports AndroidX, or if it doesn't use support libraries/AndroidX at all), add android.jetifier.ignorelist = {comma-separated list of regular expressions (or simply names) of the libraries that you don't want to be jetified} to the gradle.properties file.
- If you believe this library needs to be jetified (e.g., if it uses old support libraries and breaks your app if it isn't jetified), contact the library's authors to update this library to support AndroidX and use the supported version once it is released.
If you need further help, please leave a comment at https://issuetracker.google.com/issues/140747218.
* 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 4s
]
stdout[
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
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:preReleaseBuild UP-TO-DATE
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:compileReleaseAidl NO-SOURCE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:xrmanifest.androidlib:compileReleaseRenderscript NO-SOURCE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:generateReleaseResValues UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:generateReleaseResources UP-TO-DATE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :launcher:extractProguardFiles UP-TO-DATE
> Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:xrmanifest.androidlib:packageReleaseResources UP-TO-DATE
> Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:xrmanifest.androidlib:parseReleaseLocalResources UP-TO-DATE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues
> Task :unityLibrary:extractDeepLinksForAarRelease
> Task :unityLibrary:generateReleaseBuildConfig
> Task :unityLibrary:xrmanifest.androidlib:generateReleaseBuildConfig
> Task :unityLibrary:generateReleaseResources
> Task :unityLibrary:xrmanifest.androidlib:javaPreCompileRelease
> Task :launcher:checkReleaseDuplicateClasses FAILED
> Task :unityLibrary:xrmanifest.androidlib:mergeReleaseJniLibFolders
> Task :unityLibrary:xrmanifest.androidlib:processReleaseManifest
package="com.UnityTechnologies.XR.Manifest" found in source AndroidManifest.xml: C:\Users\yanni\source\repos\VeroverDeStadUnity\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\xrmanifest.androidlib\AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
> Task :unityLibrary:packageReleaseResources
> Task :unityLibrary:mergeReleaseNativeLibs
20 actionable tasks: 10 executed, 10 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <9cedf0d52e2b458485a933e93180d3da>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <9cedf0d52e2b458485a933e93180d3da>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <9cedf0d52e2b458485a933e93180d3da>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <9cedf0d52e2b458485a933e93180d3da>: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 <9cedf0d52e2b458485a933e93180d3da>: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 <9cedf0d52e2b458485a933e93180d3da>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <9cedf0d52e2b458485a933e93180d3da>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <9cedf0d52e2b458485a933e93180d3da>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
This is in Unity 2022.3.41f1, I have tried a few other 2022 and 2021 LTS editors. I have also tried Unity 6, which didn’t work either.
I’ve tried a few solutions I found online, such as using custom Gradle properties, but none fix the issue so far. What I find especially strange is that Unity keeps reporting that I use Gradle 7.4.2 even though I have changed the Gradle plugin used to a 8.9 version I installed with Android Studio in the Editor Preferences.
When I try to build an empty test project with the same packages installed as my project, it works just fine. When I then try to use the same settings of this test project in my main project, it does not fix the issue.
Relevant (?) installed packages include:
- Android Logcat 1.4.2
- AR Foundation 5.1.5
- Google ARCore XR Plugin 5.1.5
- In-App Purchasing 4.12.2