firebase-unity-sdk: Unity 2021.3.40f1 Android build fails.
Description
Android build fails for Unity project with only Firebase Analytics installed. For my game project, only Firebase Analytics and Messaging 11.6.0 pass build without problems, all versions after 11.7.0 fail to build.
Build environment
Unity : 2021.3.40f1 (sillicon) Build Target : Android Firebase Analytics : 12.1.0 Gradle Version : 4.2.2 Compile Sdk Version : 34 Minimum Sdk Version : 22 Target Sdk Version : 34 BuildToolsVersion : 30.0.2
Cutom Main Gradle:
Assets/Plugins/Android/mainTemplate.gradle
// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each { project ->
project.repositories {
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
maven {
url "https://maven.google.com"
}
maven {
url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:22
}
mavenLocal()
mavenCentral()
}
}
// Android Resolver Repos End
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-base:18.5.0' // Assets/Firebase/Editor/AppDependencies.xml:17
implementation 'com.google.firebase:firebase-analytics:22.0.2' // Assets/Firebase/Editor/AppDependencies.xml:15
implementation 'com.google.firebase:firebase-analytics-unity:12.1.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
implementation 'com.google.firebase:firebase-app-unity:12.1.0' // Assets/Firebase/Editor/AppDependencies.xml:22
implementation 'com.google.firebase:firebase-common:21.0.0' // Assets/Firebase/Editor/AppDependencies.xml:13
// Android Resolver Dependencies End
**DEPS**}
// Android Resolver Exclusions Start
android {
packagingOptions {
exclude ('/lib/arm64-v8a/*' + '*')
exclude ('/lib/armeabi/*' + '*')
exclude ('/lib/mips/*' + '*')
exclude ('/lib/mips64/*' + '*')
exclude ('/lib/x86/*' + '*')
exclude ('/lib/x86_64/*' + '*')
}
}
// Android Resolver Exclusions End
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
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**
}**REPOSITORIES**
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**
Custom Gradle Properties:
Assets/Plugins/Android/gradleTemplate.properties
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
android.enableR8=**MINIFY_WITH_R_EIGHT**
unityStreamingAssets=**STREAMING_ASSETS**
# Android Resolver Properties Start
android.useAndroidX=true
android.enableJetifier=true
# Android Resolver Properties End
**ADDITIONAL_PROPERTIES**
Reproducing the issue
- Generate an empty project for Unity 2021.3.40f1
- Download and install 12.1.0 from API for Unity
- Switch platform to Android
- Execute build
Firebase Unity SDK Version
12.1.0
Unity editor version
2021.3.40f1
Installation Method
.unitypackage
Problematic Firebase Component(s)
Analytics
Other Firebase Component(s) in use
No response
Additional SDKs you are using
Firebase Analytics : 12.1.0 only
Targeted Platform(s)
Apple Platforms
Unity editor platform
Mac
Scripting Runtime
IL2CPP
Release Distribution Type
Pre-built SDK from https://firebase.google.com/download/unity
Relevant Log Output
> Configure project :launcher
WARNING:: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 7.0 of the Android Gradle plugin.
You will no longer be able to disable R8
WARNING:: Using flatDir should be avoided because it doesn't support any meta-data formats.
> Configure project :unityLibrary
WARNING:: Using flatDir should be avoided because it doesn't support any meta-data formats.
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :launcher:preBuild UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:writeReleaseAarMetadata UP-TO-DATE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:generateReleaseResValues UP-TO-DATE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResources UP-TO-DATE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :launcher:writeReleaseApplicationId UP-TO-DATE
> Task :unityLibrary:packageReleaseResources UP-TO-DATE
> Task :launcher:analyticsRecordingRelease
> Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
> Task :unityLibrary:processReleaseManifest UP-TO-DATE
> Task :launcher:checkReleaseAarMetadata UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :launcher:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
> Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
> Task :launcher:mergeReleaseResources UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :launcher:extractDeepLinksRelease UP-TO-DATE
> Task :launcher:processReleaseMainManifest UP-TO-DATE
> Task :launcher:processReleaseManifest UP-TO-DATE
> Task :launcher:processReleaseManifestForPackage UP-TO-DATE
> Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
> Task :launcher:mergeReleaseShaders UP-TO-DATE
> Task :launcher:compileReleaseShaders NO-SOURCE
> Task :launcher:generateReleaseAssets UP-TO-DATE
> Task :unityLibrary:generateReleaseRFile UP-TO-DATE
> Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
> Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
> Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
> Task :unityLibrary:bundleLibCompileToJarRelease UP-TO-DATE
> Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
> Task :unityLibrary:processReleaseJavaRes UP-TO-DATE
> Task :unityLibrary:bundleLibResRelease UP-TO-DATE
> Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
> Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
> Task :unityLibrary:copyReleaseJniLibsProjectOnly UP-TO-DATE
> Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
> Task :unityLibrary:compileReleaseShaders NO-SOURCE
> Task :unityLibrary:generateReleaseAssets UP-TO-DATE
> Task :unityLibrary:packageReleaseAssets
> Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
> Task :launcher:mergeReleaseNativeLibs UP-TO-DATE
> Task :launcher:stripReleaseDebugSymbols UP-TO-DATE
> Task :launcher:extractReleaseNativeSymbolTables UP-TO-DATE
> Task :launcher:mergeReleaseAssets
> Task :launcher:desugarReleaseFileDependencies UP-TO-DATE
aapt2 W 07-18 16:45:46 62768 19096610 LoadedArsc.cpp:682] Unknown chunk type '200'.
> Task :launcher:compressReleaseAssets
> Task :launcher:processReleaseResources
> Task :launcher:mergeExtDexRelease FAILED
> Task :launcher:mergeReleaseNativeDebugMetadata
46 actionable tasks: 7 executed, 39 up-to-date
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
ERROR:: D8: com.android.tools.r8.kotlin.H
FAILURE: Build 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 play-services-measurement-api-22.0.2.aar (com.google.android.gms:play-services-measurement-api:22.0.2) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-incremental-transform=true, dexing-is-debuggable=false, dexing-min-sdk=22, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: /Users/xxxx/.gradle/caches/transforms-2/files-2.1/6976e2f50f65279ba5dfd83f76eace20/jetified-play-services-measurement-api-22.0.2-runtime.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.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)
CommandInvokationFailure: Gradle build failed.
/Applications/Unity/Hub/Editor/2021.3.40f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2021.3.40f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.7.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
Environment Variables:
AMPLITUDE_API_KEY_REDBUCKET_DEV = 46b8b46515e7632fc42a504b72e05fd0
DEBUG_ENV_VAR = UnityHub
XPC_FLAGS = 0x0
__CFBundleIdentifier = com.unity3d.unityhub
AMPLITUDE_API_KEY_GREENBUCKET_DEV = 3ded2a762163603391a425f688f990c8
AMPLITUDE_TOKEN_REDBUCKET_DEV = U4PSN7S7PuYVRODivvdcFwbu8R6IHGqa
SECURITYSESSIONID = 186b3
AMPLITUDE_API_KEY_GREENBUCKET_PROD = c86fea37a9e1d3f0878b96e15b111c7c
JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
SENTRY_ACCESS_TOKEN = 3df78d9e53f8456aa90fbae044ce1a6261421ab1d0014674bc2e933477289017
AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_DEV = client-wbjHYrmeSR87GmWOE7LDpf7sUySOIKHm
AMPLITUDE_TOKEN_GREENBUCKET_PROD = ZpUcbAdZXJYzNSoHsAWtL_s_JppwWid9
AMPLITUDE_API_KEY = 28f3cae0b33b8b3702120c9ed1a935aa
XPC_SERVICE_NAME = application.com.unity3d.unityhub.101124541.101124547
ANDROID_NDK_ROOT = /Applications/Unity/Hub/Editor/2021.3.40f1/PlaybackEngines/AndroidPlayer/NDK
AMPLITUDE_API_KEY_STAGING = 83ee04fccc67e4fcc7dd527c4c6f1e21
WOOTRIC_CLIENT_TOKEN = NPS-aa8be4c3
USER = xxxx
MallocNanoZone = 0
LOGNAME = xxxx
__CF_USER_TEXT_ENCODING = 0x1F5:0x1:0xE
AMPLITUDE_API_KEY_YELLOWBUCKET_DEV = 48835b4d1f5e342aefe5f016324d296a
PATH = /usr/bin:/bin:/usr/sbin:/sbin
LaunchInstanceID = 595382F8-C935-4628-9245-B3718DD7CAC1
SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.7EPy1rNyEh/Listeners
AMPLITUDE_API_KEY_YELLOWBUCKET_PROD = e03a9bbe92dc38a88cdb068d24c65b46
AMPLITUDE_TOKEN_REDBUCKET_PROD = jTIgKs5KTZOjiqEEVdZFbgo_VRhABduL
AMPLITUDE_TOKEN_YELLOWBUCKET_PROD = UYDQtPOw83dIfVy3SrW5oMyo7ru4PRkV
HOME = /Users/xxxx
TMPDIR = /var/folders/3x/lstvjdcj3gqbt0fwhhg0mpqm0000gn/T/
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
AMPLITUDE_TOKEN_GREENBUCKET_DEV = 84H2gMm_FJzhr3mBaX1lM1JVukmCM7d9
AMPLITUDE_TOKEN_YELLOWBUCKET_DEV = wKi8foVigDditGFvmZewRFWsEbX9Y0YO
SHELL = /bin/zsh
AMPLITUDE_API_KEY_REDBUCKET_PROD = ca12bb461ea96f9bdf5df4ded7d52994
AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_PROD = client-zH8Y7OK1i331EKuG77C6UxN8ygcM6LzS
COMMAND_MODE = unix2003
BURST_ANDROID_MIN_API_LEVEL = 22
stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
ERROR:: D8: com.android.tools.r8.kotlin.H
FAILURE: Build 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 play-services-measurement-api-22.0.2.aar (com.google.android.gms:play-services-measurement-api:22.0.2) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-incremental-transform=true, dexing-is-debuggable=false, dexing-min-sdk=22, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: /Users/xxxx/.gradle/caches/transforms-2/files-2.1/6976e2f50f65279ba5dfd83f76eace20/jetified-play-services-measurement-api-22.0.2-runtime.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.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
]
stdout[
> Configure project :launcher
WARNING:: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 7.0 of the Android Gradle plugin.
You will no longer be able to disable R8
WARNING:: Using flatDir should be avoided because it doesn't support any meta-data formats.
> Configure project :unityLibrary
WARNING:: Using flatDir should be avoided because it doesn't support any meta-data formats.
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :launcher:preBuild UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:writeReleaseAarMetadata UP-TO-DATE
> Task :launcher:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:generateReleaseResValues UP-TO-DATE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResources UP-TO-DATE
> Task :launcher:javaPreCompileRelease UP-TO-DATE
> Task :launcher:writeReleaseApplicationId UP-TO-DATE
> Task :unityLibrary:packageReleaseResources UP-TO-DATE
> Task :launcher:analyticsRecordingRelease
> Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
> Task :unityLibrary:processReleaseManifest UP-TO-DATE
> Task :launcher:checkReleaseAarMetadata UP-TO-DATE
> Task :launcher:generateReleaseResValues UP-TO-DATE
> Task :launcher:generateReleaseResources UP-TO-DATE
> Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
> Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
> Task :launcher:mergeReleaseResources UP-TO-DATE
> Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :launcher:extractDeepLinksRelease UP-TO-DATE
> Task :launcher:processReleaseMainManifest UP-TO-DATE
> Task :launcher:processReleaseManifest UP-TO-DATE
> Task :launcher:processReleaseManifestForPackage UP-TO-DATE
> Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
> Task :launcher:mergeReleaseShaders UP-TO-DATE
> Task :launcher:compileReleaseShaders NO-SOURCE
> Task :launcher:generateReleaseAssets UP-TO-DATE
> Task :unityLibrary:generateReleaseRFile UP-TO-DATE
> Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
> Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
> Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
> Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
> Task :unityLibrary:bundleLibCompileToJarRelease UP-TO-DATE
> Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
> Task :unityLibrary:processReleaseJavaRes UP-TO-DATE
> Task :unityLibrary:bundleLibResRelease UP-TO-DATE
> Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
> Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
> Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
> Task :unityLibrary:copyReleaseJniLibsProjectOnly UP-TO-DATE
> Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
> Task :unityLibrary:compileReleaseShaders NO-SOURCE
> Task :unityLibrary:generateReleaseAssets UP-TO-DATE
> Task :unityLibrary:packageReleaseAssets
> Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
> Task :launcher:mergeReleaseNativeLibs UP-TO-DATE
> Task :launcher:stripReleaseDebugSymbols UP-TO-DATE
> Task :launcher:extractReleaseNativeSymbolTables UP-TO-DATE
> Task :launcher:mergeReleaseAssets
> Task :launcher:desugarReleaseFileDependencies UP-TO-DATE
aapt2 W 07-18 16:45:46 62768 19096610 LoadedArsc.cpp:682] Unknown chunk type '200'.
> Task :launcher:compressReleaseAssets
> Task :launcher:processReleaseResources
> Task :launcher:mergeExtDexRelease FAILED
> Task :launcher:mergeReleaseNativeDebugMetadata
46 actionable tasks: 7 executed, 39 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <8726dd6620e34d1287c5f82caa1b502d>: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 <8726dd6620e34d1287c5f82caa1b502d>: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 <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <8726dd6620e34d1287c5f82caa1b502d>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 35
Same problem here as well, but 11.6.0 and below works without issue:
Just curious, how did the new SDK versions with issues get passed and released? This is 100% reproducible and should be able to catch by testing against different Unity versions before releasing.
My workaround is as below: https://stackoverflow.com/questions/77926070/agpbi-kinderror-textcom-android-tools-r8-kotlin-h-sources-to
I think it’s better. Because minSdkVersion can be the minimal that Unity can provide (22).
My working environment:
That table is now outdated, new Gradle/AGP versions included in latest Unity versions are:
After more testing, I’m able to get Android 34 to build with either of the following:
This must be a compatibility issue due to the old Gradle/AGP version used by Unity.
I got this same error when using the latest Unity 2022.3.38f1 LTS with the latest Firebase unity SDK 12.1.0 while targeting Android 34:
The problem doesn’t happen when targeting Android 33.
@argzdev The Unity thread you linked to is about a different “AAPT2” error that Unity devs are working on fixing in Unity 2021 LTS (see Unity announcement about Unity 2021 + Android 34 build failure). However, Unity devs claim Unity 2022 doesn’t have this “AAPT2” error and I can confirm it’s indeed the case. Their “AAPT2” workaround does work with Unity 2021 but it only addresses the “AAPT2” error and after that I’m getting the “Failed to transform” error above. From the many Unity threads I have been following, Unity devs are not working on the above error which only happens when you have a dependency on Firebase.
I tried the following combinations and can’t get Android 34 build to work:
Google has a deadline of 08/30/2024 to require all app updates to target Android 34. There is a risk that the Unity devs can’t get the AAPT2 error fixed in time for Unity 2021. I think it’s very unlikely we can count on them to get the “Failed to transform” error fixed in time. Can Firebase devs help here?
Thank you all for the alternative solutions. We’ve also made some changes on our side with the solution suggested by @manugildev. This pull request that is now available in the most EDM4U release
1.2.182should be able to work with the upcoming2021.3.42f1Unity Editor version, however with the caveat that the minSdkVersion should be changed from22to24(We’re still investigating this issue).If however, you’d like use this with Unity version
2021.3.40f1builds, there are a few solutions:settingsTemplate.gradleby your project directory should work.Note, the EDM4U is currently available in
tar.gz. We’ll keep you posted once we’ve released packaged.unitypackagewith thefirebase-unity-sdkas soon as we can.Builds seem to be failing in newer Unity 2021.3.41f1 with error message:
To reproduce:
@argzdev Unity 2021.3.37f1 or later : Updated Android Gradle Plugin to 4.2.2 (from 4.0.1). The version of Gradle on 2021.3.40f1 is 6.7.1.
I believe that many developers only use LTS. I can’t imagine when it will be supported.
@Bestlis Your issue has already been reported https://github.com/googlesamples/unity-jar-resolver/issues/703. As a workaround to fix it while Google investigates a real fix:
Player Settings>Other Settings>Minimum API LevelAlso as a fix option, you can use a version of unity that uses AGP 7.1.2 (e.g. 2022.3.30f1). Or for other versions of unity, you can downgrade AGP by enabling “Custom Base Gradle Template” in the project settings and downgrading the AGP version in Assets/Plugins/Android/settingsTemplate.gradle from 7.4.2 to 7.1.2.
Thanks for the extra details and workaround, @fengx1024. I’m sure this’ll help a lot of developers with the similar issue.
For what it’s worth, the problem is due to the version compatibility of the Unity editor with the Android Gradle plugin. In the Unity documentations, the version compatibility is shown that the Unity Editor versions does not have AGP 8.1+. This is not something we can control on Firebase side.
We can only wait for Unity to fully support AGP 8 onwards.
Hi @IShix-g, thanks for reaching out. Unfortunately, it seems that there’s an issue with Firebase SDK version
12.1.0. For context, there are breaking changes in Firebase Android SDK which requires compileSdkVersion 34 (Start on Firebase Unity SDK version12.0.0onwards).Now according to the Unity forums, Unity Editors currently do not support compileSdkVersion 34, and is currently being worked on by their engineers. There are workarounds, by the Unity engineer, however I haven’t tried it myself.
While waiting for Unity to fix the version to support compileSdkVersion 34, another mitigation would be to downgrade Firebase SDK version 11.9.0 and also lower your compileSdkVersion to 33 or lower. Let me know if that works. Thanks!
Hi folks, the Firebase Unity SDK version
12.2.0has now been released. This includes the latest version of the unity-jar-resolver EDM4U v1.2.182, and it should work with the latest version of Unity Editor version2021.3.42f1. Please note that minimum API has to be set to level 24. That said, I’ll go ahead and close this thread.Unity editor below Unity 6 don’t support API 34 and there is major change in update so either target 33 with old plugin or just add below given file to make editor compatible. Also make user you gradle version is above 6.8 else you will get new errors. Please follow this link to add settingTemplate.gradle.
https://discussions.unity.com/t/unity-2021-3-and-android-build-failure-when-using-android-legacy-libraries-and-target-api-34/952277/10
Same problem here. As said above upgrading to minSdkVersion >= 24 solves the issue, I couldn’t do that