Closed IShix-g closed 5 months ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
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 version 12.0.0
onwards).
Breaking change: Changed the required minimum compileSdkVersion to be 34 or higher. Breaking change: Updated minSdkVersion to API level 21 or higher.
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 @argzdev, I tried following the instructions and was able to install it without any problems. If you specify Unity 2019.1 or later, it would be helpful if you could at least develop the plugin with the current LTS in mind. I know this may be difficult, but please consider this. Thank you for your reply.
Has anyone tried/got a solid work around for this? Getting the same error and tried the Unity engineer instructions, absolutely nothing has worked thus far. Been trying to build for days and getting nowhere.
Any instructions for a work around posted here would be truly appreciated. (as unity forums appear to be down)
Hi @lilzubr, In my case, I am using the older version, 11.6.0. I'd like to hear how you all handle this.
Unity : 2021.3.40f1 (sillicon) Build Target : Android Firebase Analytics : 11.6.0 Firebase Messaging : 11.6.0 External Dependency Manager : 1.2.181 Gradle Version : 4.2.2 Compile Sdk Version : 34 Minimum Sdk Version : 22 Target Sdk Version : 34 BuildToolsVersion : 30.0.2
Unity 2021.3.37f1 or later : Updated Android Gradle Plugin to 4.2.2 (from 4.0.1). Custom Base Gradle Template no longer requires an upgrade process.
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:
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 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-enable-jacoco-instrumentation=false, dexing-is-debuggable=false, dexing-min-sdk=22, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: C:\Users\xiaofeng\.gradle\caches\transforms-3\64b0c7447f3c6bbe741650ffe23d8c98\transformed\jetified-play-services-measurement-api-22.0.2-runtime.jar.
> Error while dexing.
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?
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.
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.
Unity version | Gradle version | Android Gradle Plug-in version |
---|---|---|
2023.2 | 7.6 | 7.3.1 |
2022.3 | 7.2 | 7.1.2 |
2021.3 | 6.1.1 | 4.0.1 |
We can only wait for Unity to fully support AGP 8 onwards.
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.
@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.
We can only wait for Unity to fully support AGP 8 onwards.
I believe that many developers only use LTS. I can't imagine when it will be supported.
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.
Unity version Gradle version Android Gradle Plug-in version 2023.2 7.6 7.3.1 2022.3 7.2 7.1.2 2021.3 6.1.1 4.0.1 We can only wait for Unity to fully support AGP 8 onwards.
That table is now outdated, new Gradle/AGP versions included in latest Unity versions are: Unity version | Gradle version | Android Gradle Plug-in version |
---|---|---|
Unity-6 | 8.4 | 8.3.0 |
2022.3 | 7.5.1 | 7.4.2 |
2021.3 | 7.5.1 | 7.4.2 |
Builds seem to be failing in newer Unity 2021.3.41f1 with error message:
FAILURE: Build completed with 3 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:checkReleaseAarMetadata'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
> Could not find com.google.firebase:firebase-analytics-unity:12.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-analytics-unity/12.1.0/firebase-analytics-unity-12.1.0.pom
- https://repo.maven.apache.org/maven2/com/google/firebase/firebase-analytics-unity/12.1.0/firebase-analytics-unity-12.1.0.pom
- file:/G:/Unity_2021/TestAndroid34/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-analytics-unity-12.1.0.jar
- file:/G:/Unity_2021/TestAndroid34/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-analytics-unity.jar
Required by:
project :launcher > project :unityLibrary
> Could not find com.google.firebase:firebase-app-unity:12.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-app-unity/12.1.0/firebase-app-unity-12.1.0.pom
- https://repo.maven.apache.org/maven2/com/google/firebase/firebase-app-unity/12.1.0/firebase-app-unity-12.1.0.pom
- file:/G:/Unity_2021/TestAndroid34/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-app-unity-12.1.0.jar
- file:/G:/Unity_2021/TestAndroid34/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-app-unity.jar
Required by:
project :launcher > project :unityLibrary
* 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.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':unityLibrary:generateReleaseRFile'.
> Could not resolve all files for configuration ':unityLibrary:releaseCompileClasspath'.
> Could not find com.google.firebase:firebase-analytics-unity:12.1.0.
Required by:
project :unityLibrary
> Could not find com.google.firebase:firebase-app-unity:12.1.0.
Required by:
project :unityLibrary
* 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.
To reproduce:
Hi all,
I personally haven't been able to reliably reproduce this issue, the closest I have come has been installing 2021.3.20f1 (really, any version before 38f1), which originally only has android-29 and 30 platform support, which gives me a different error than everyone else is reporting (/Users/amaurice/.gradle/caches/transforms-2/files-2.1/930c42acd29d295ce5bc495c3b84423e/core-1.9.0/res/values/values.xml:104:5-113:25: AAPT: error: resource android:attr/lStar not found.
), and is fixed by installing android-34 platform support. Likewise, our build and test machines which we build all our tests on currently uses 2020.3.34f1, so even older than that, and hasn't had issues, but that uses a different Android tool setup.
My best guess is that there is something different about my own machine, and the test machines, between the various tool installations, that is being used to avoid this issue. However, looking at the generated Android project created by Unity, all the paths seem to pointing to the Android SDK, NDK, Java JDK, and Gradle version that comes with that version of Unity. If you all could double check that as well, I would appreciate it, as that might be a possible explanation, that it is pulling in a different version of those tools than expected.
Another thing that could be shared would be the final generated build.gradle file, with the actual numbers it is using. This should be in your Unity project at a path like Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/build.gradle
. For example, here is one that I have from our Analytics testapp, with Unity 2021.3.40f1:
// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each { project ->
project.repositories {
def unityProjectPath = $/file:////Users/amaurice/M151/analytics/$.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'
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
implementation project('GameLoops.androidlib')
implementation project('FirebaseApp.androidlib')
}
// Android Resolver Exclusions Start
android {
packagingOptions {
exclude ('/lib/armeabi/*' + '*')
exclude ('/lib/armeabi-v7a/*' + '*')
exclude ('/lib/mips/*' + '*')
exclude ('/lib/mips64/*' + '*')
exclude ('/lib/x86/*' + '*')
exclude ('/lib/x86_64/*' + '*')
}
}
// Android Resolver Exclusions End
android {
compileSdkVersion 34
buildToolsVersion '30.0.2'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 26
targetSdkVersion 34
ndk {
abiFilters 'arm64-v8a'
}
versionCode 1
versionName '1.0'
consumerProguardFiles 'proguard-unity.txt'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
packagingOptions {
doNotStrip '*/arm64-v8a/*.so'
}
}
Note that the targetSdkVersion is 34, which is now required by the Firebase Android SDK, and thus the Firebase Unity SDK.
Also, check the file at Library/Bee/Android/Prj/IL2CPP/Gradle/build.gradle
, which should contain a line like classpath 'com.android.tools.build:gradle:4.2.2'
, which is the Android Gradle Plugin it is using. I am seeing 4.0.1 and 4.2.2 across the 2021 versions, which lines up with https://docs.unity3d.com/2021.3/Documentation/Manual/android-gradle-overview.html And check Library/Bee/Android/Prj/IL2CPP/Gradle/gradle/wrapper/gradle-wrapper.properties
, to see which gradle version it is using, to again make sure that is what is expected.
Also, as for why this became an issue with 11.7.0, that included an update to the Firebase Android SDK which increased the compileSdkVersion to 33 (https://firebase.google.com/support/release-notes/android#analytics_v21-4-0), and that number since increased to 34 with the 12.0.0 release, which included this Android dependency update (https://firebase.google.com/support/release-notes/android#2024-05-02). But if it isn't possible to target 33 or 34, a fallback option is to use 11.6.0, though I know the Play Store is going to start requiring the newer targets at some point, so ideally we can figure out what the issue is.
@a-maurice I think you were not able to reproduce the error because your test app has a minSdkVersion too high. In my tests, the "Failed to transform" error only happens when minSdkVersion <= 23.
Can we expect another version of Unity that has all the correct and compatible versions of Gradle, Android SDK etc? I've been trying these workarounds to try to get my app to comply with Googles SDK 34 requirement - but no luck. My app currently crashes on startup devices with Android 14 now. Any heads-up appreciated.
@fengx1024 Unfortunately, changing the minSdkVersion doesn't seem to cause a clean build to fail for me either, though that was a good callout.
Same problem here. As said above upgrading to minSdkVersion >= 24 solves the issue, I couldn't do that
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.
Also 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.
Same problem here as well, but 11.6.0 and below works without issue:
- Unity 2022.3.38f1 + Firebase 12.1.0 => "Failed to transform play-services-measurement-api-22.0.2.aar" error.
- Unity 2022.3.38f1 + Firebase 11.9.0 => "Failed to transform play-services-measurement-api-21.6.2.aar" error.
- Unity 2022.3.38f1 + Firebase 11.8.1 => "Failed to transform play-services-measurement-api-21.5.1.aar" error.
- Unity 2022.3.38f1 + Firebase 11.7.0 => "A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction. Manifest merger failed with multiple errors, see logs" error.
- Unity 2022.3.38f1 + Firebase 11.6.0 => works without error.
- Unity 2022.3.38f1 + Firebase 11.5.0 => works without error.
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.
Which API are you targeting?
Builds seem to be failing in newer Unity 2021.3.41f1 with error message:
FAILURE: Build completed with 3 failures. 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':launcher:checkReleaseAarMetadata'. > Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'. > Could not find com.google.firebase:firebase-analytics-unity:12.1.0. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-analytics-unity/12.1.0/firebase-analytics-unity-12.1.0.pom - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-analytics-unity/12.1.0/firebase-analytics-unity-12.1.0.pom - file:/G:/Unity_2021/TestAndroid34/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-analytics-unity-12.1.0.jar - file:/G:/Unity_2021/TestAndroid34/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-analytics-unity.jar Required by: project :launcher > project :unityLibrary > Could not find com.google.firebase:firebase-app-unity:12.1.0. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-app-unity/12.1.0/firebase-app-unity-12.1.0.pom - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-app-unity/12.1.0/firebase-app-unity-12.1.0.pom - file:/G:/Unity_2021/TestAndroid34/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-app-unity-12.1.0.jar - file:/G:/Unity_2021/TestAndroid34/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-app-unity.jar Required by: project :launcher > project :unityLibrary * 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. ============================================================================== 3: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':unityLibrary:generateReleaseRFile'. > Could not resolve all files for configuration ':unityLibrary:releaseCompileClasspath'. > Could not find com.google.firebase:firebase-analytics-unity:12.1.0. Required by: project :unityLibrary > Could not find com.google.firebase:firebase-app-unity:12.1.0. Required by: project :unityLibrary * 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.
To reproduce:
- Create a new project with Unity 2021.3.41f1
- Add google-mobile-ads-sdk
- Add firebase-unity-sdk
- Build
Same error for me
Related issue reported here: https://github.com/googlesamples/unity-jar-resolver/issues/699
Hello!
We have the same problem in preparing for Google own requirements. I suppose we are waiting this to be resolved on the next week?
I really appreciate your time. We have 10+ projects and loaded development pipeline, with less than 1 month till deadline we have less and less time to finish.
If we can help in any way - let me know!
Hello!
We have the same problem in preparing for Google own requirements. I suppose we are waiting this to be resolved on the next week?
I really appreciate your time. We have 10+ projects and loaded development pipeline, with less than 1 month till deadline we have less and less time to finish.
If we can help in any way - let me know!
My project details:
Platform: Mac M1
Unity version: 2021.3.31f1 (updating to 2021.3.41f1)
Firebase products used: version 11.9.0 (updating to 12.1.0)
Firebase.Analytics
Firebase.App
Firebase.Crashlytics
Firebase.DynamicLinks
Firebase.Messaging
Firebase.Platform
Firebase.RemoteConfig
Firebase.TaskExtension
Google.MiniJson
Using ExternalDependencyManager: Yes
Cur min android sdk: 22 (updating to 24)
Cur target sdk: 33 (updating to 34)
Steps:
Upgrade project to 2021.3.41f1
Build- If you get the “build tools 32.0.0 is corrupted, install using sdk manager” error, then rename “/Applications/Unity/Hub/Editor/2021.3.41f1/PlaybackEngines/AndroidPlayer/SDK/build-tools/32.0.0/d8” file to dx and “/Applications/Unity/Hub/Editor/2021.3.41f1/PlaybackEngines/AndroidPlayer/SDK/build-tools/32.0.0/lib/d8.jar” to dx.jar
Then, if you are getting “Could not find com.google.firebase:firebase-analytics-unity:12.1.0.” type errors, then follow this link. After doing this my build was successful without crashing.
Same problem here as well, but 11.6.0 and below works without issue:
- Unity 2022.3.38f1 + Firebase 12.1.0 => "Failed to transform play-services-measurement-api-22.0.2.aar" error.
- Unity 2022.3.38f1 + Firebase 11.9.0 => "Failed to transform play-services-measurement-api-21.6.2.aar" error.
- Unity 2022.3.38f1 + Firebase 11.8.1 => "Failed to transform play-services-measurement-api-21.5.1.aar" error.
- Unity 2022.3.38f1 + Firebase 11.7.0 => "A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction. Manifest merger failed with multiple errors, see logs" error.
- Unity 2022.3.38f1 + Firebase 11.6.0 => works without error.
- Unity 2022.3.38f1 + Firebase 11.5.0 => works without error.
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.
Which API are you targeting?
SDK 34
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.182
should be able to work with the upcoming 2021.3.42f1
Unity Editor version, however with the caveat that the minSdkVersion should be changed from 22
to 24
(We're still investigating this issue).
If however, you'd like use this with Unity version 2021.3.40f1
builds, there are a few solutions:
settingsTemplate.gradle
by your project directory should work.Note, the EDM4U is currently available in tar.gz
. We'll keep you posted once we've released packaged .unitypackage
with the firebase-unity-sdk
as soon as we can.
Unity : 2022.3.40f1 (sillicon) Build Target : Android Firebase Analytics : 12.2.0 Compile Sdk Version : 34 Minimum Sdk Version : 22 Target Sdk Version : 34
Assets/Plugins/Android/mainTemplate.gradle
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.2.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
implementation 'com.google.firebase:firebase-app-unity:12.2.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 {
namespace "com.unity3d.player"
ndkPath "**NDKPATH**"
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
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**
}
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**
Assets/Plugins/Android/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**
Assets/Plugins/Android/settingsTemplate.properties
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 (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:22
}
mavenLocal()
// Android Resolver Repos End
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
}
}
Generate an empty project for Unity 2022.3.40f1 Switch platform to Android Download and install 12.2.0 from [API for Unity] Execute build
12.2.0
2022.3.40f1
.unitypackage
Analytics
Firebase Analytics : 12.2.0 only
Android Platforms
Windows
IL2CPP
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2022.3.40f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2022.3.40f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.5.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease"
Environment Variables:
PROCESSOR_ARCHITECTURE = AMD64
AMPLITUDE_API_KEY_YELLOWBUCKET_DEV = 48835b4d1f5e342aefe5f016324d296a
AMPLITUDE_API_KEY_GREENBUCKET_PROD = c86fea37a9e1d3f0878b96e15b111c7c
DriverData = C:\Windows\System32\Drivers\DriverData
USERDOMAIN = BESTLIS-PC
CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
COMPUTERNAME = BESTLIS-PC
DEBUG_ENV_VAR = UnityHub
LOGONSERVER = \\BESTLIS-PC
VS110COMNTOOLS = C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
PUBLIC = C:\Users\Public
ProgramData = C:\ProgramData
SESSIONNAME = Console
AMPLITUDE_TOKEN_YELLOWBUCKET_PROD = UYDQtPOw83dIfVy3SrW5oMyo7ru4PRkV
ALLUSERSPROFILE = C:\ProgramData
Path = C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin;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\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\VisualSVN\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\OpenSSL-Win64\bin;C:\Program Files\Java\jdk1.8.0_231\bin;C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Users\Bestlis\AppData\Local\Programs\Python\Python311;C:\Users\Bestlis\AppData\Local\Programs\Python\Python311\Scripts;C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility;C:\Users\Bestlis\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\TortoiseGit\bin;C:\Users\Bestlis\AppData\Local\Microsoft\WindowsApps;C:\Users\Bestlis\.dotnet\tools;C:\Program Files\Azure Data Studio\bin;C:\Users\Bestlis\AppData\Local\Programs\Microsoft VS Code\bin
SystemRoot = C:\Windows
windir = C:\Windows
AMPLITUDE_API_KEY_REDBUCKET_DEV = 46b8b46515e7632fc42a504b72e05fd0
ProgramFiles(x86) = C:\Program Files (x86)
ProgramW6432 = C:\Program Files
AMPLITUDE_TOKEN_GREENBUCKET_PROD = ZpUcbAdZXJYzNSoHsAWtL_s_JppwWid9
OS = Windows_NT
ANDROID_NDK_ROOT = C:\Program Files\Unity\Hub\Editor\2022.3.40f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK
PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
HOMEPATH = \Users\Bestlis
FPS_BROWSER_USER_PROFILE_STRING = Default
AMPLITUDE_TOKEN_REDBUCKET_DEV = U4PSN7S7PuYVRODivvdcFwbu8R6IHGqa
CHROME_CRASHPAD_PIPE_NAME = \\.\pipe\crashpad_15964_PPGSSMQRWZBYFTAI
PROCESSOR_LEVEL = 6
CommonProgramFiles = C:\Program Files\Common Files
JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2022.3.40f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
USERDOMAIN_ROAMINGPROFILE = BESTLIS-PC
TEMP = C:\Users\Bestlis\AppData\Local\Temp
ProgramFiles = C:\Program Files
CommonProgramW6432 = C:\Program Files\Common Files
AMPLITUDE_TOKEN_YELLOWBUCKET_DEV = wKi8foVigDditGFvmZewRFWsEbX9Y0YO
AMPLITUDE_API_KEY_GREENBUCKET_DEV = 3ded2a762163603391a425f688f990c8
AMPLITUDE_API_KEY_REDBUCKET_PROD = ca12bb461ea96f9bdf5df4ded7d52994
HOMEDRIVE = C:
AMPLITUDE_API_KEY_STAGING = 83ee04fccc67e4fcc7dd527c4c6f1e21
USERNAME = Bestlis
OneDrive = C:\Users\Bestlis\OneDrive
AMPLITUDE_API_KEY_YELLOWBUCKET_PROD = e03a9bbe92dc38a88cdb068d24c65b46
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
AMPLITUDE_TOKEN_REDBUCKET_PROD = jTIgKs5KTZOjiqEEVdZFbgo_VRhABduL
TelerikWPFDir = C:\Program Files (x86)\Telerik\RadControls for WPF Q2 2013\
NUMBER_OF_PROCESSORS = 8
AMPLITUDE_TOKEN_GREENBUCKET_DEV = 84H2gMm_FJzhr3mBaX1lM1JVukmCM7d9
AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_DEV = client-wbjHYrmeSR87GmWOE7LDpf7sUySOIKHm
ComSpec = C:\Windows\system32\cmd.exe
TelerikSLDir = C:\Program Files (x86)\Telerik\RadControls for Silverlight Q2 2013\
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
PROCESSOR_REVISION = 9e0a
AMPLITUDE_DEPLOYMENT_KEY_RED_BUCKET_PROD = client-zH8Y7OK1i331EKuG77C6UxN8ygcM6LzS
TMP = C:\Users\Bestlis\AppData\Local\Temp
SystemDrive = C:
AMPLITUDE_API_KEY = 28f3cae0b33b8b3702120c9ed1a935aa
FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer
OneDriveConsumer = C:\Users\Bestlis\OneDrive
SENTRY_ACCESS_TOKEN = 3df78d9e53f8456aa90fbae044ce1a6261421ab1d0014674bc2e933477289017
APPDATA = C:\Users\Bestlis\AppData\Roaming
CARBON_MEM_DISABLE = 1
PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
LOCALAPPDATA = C:\Users\Bestlis\AppData\Local
USERPROFILE = C:\Users\Bestlis
WOOTRIC_CLIENT_TOKEN = NPS-aa8be4c3
stderr[
Note: D:\UnityProjects\UnityTest22\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
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 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-enable-jacoco-instrumentation=false, dexing-is-debuggable=false, dexing-min-sdk=22, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: C:\Users\Bestlis\.gradle\caches\transforms-3\64b0c7447f3c6bbe741650ffe23d8c98\transformed\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.
==============================================================================
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 17s
]
stdout[
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 34
This Android Gradle plugin (7.4.2) was tested up to compileSdk = 33
This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=34
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 = 34
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.40f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.40f1\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.40f1\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.40f1\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.40f1\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.40f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files\Unity\Hub\Editor\2022.3.40f1\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.40f1\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.40f1\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.40f1\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:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues
> Task :unityLibrary:generateReleaseResources
> Task :unityLibrary:packageReleaseResources
> Task :unityLibrary:extractDeepLinksRelease
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:compileReleaseLibraryResources
> Task :unityLibrary:generateReleaseBuildConfig
> Task :unityLibrary:javaPreCompileRelease
> Task :unityLibrary:writeReleaseAarMetadata
> Task :unityLibrary:mergeReleaseShaders
> Task :unityLibrary:compileReleaseShaders NO-SOURCE
> Task :unityLibrary:generateReleaseAssets UP-TO-DATE
> Task :unityLibrary:parseReleaseLocalResources
> Task :unityLibrary:processReleaseManifest
> Task :unityLibrary:packageReleaseAssets
> Task :launcher:preBuild UP-TO-DATE
> Task :launcher:preReleaseBuild UP-TO-DATE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :launcher:generateReleaseResValues
> Task :launcher:mapReleaseSourceSetPaths
> Task :launcher:generateReleaseResources
> Task :unityLibrary:processReleaseJavaRes
> Task :unityLibrary:bundleLibResRelease
> Task :unityLibrary:generateReleaseRFile
> Task :launcher:createReleaseCompatibleScreenManifests
> Task :launcher:extractDeepLinksRelease
> Task :unityLibrary:mergeReleaseJniLibFolders
> Task :launcher:processReleaseMainManifest
> Task :launcher:processReleaseManifest
> Task :launcher:processApplicationManifestReleaseForBundle
> Task :launcher:mergeReleaseResources
> Task :launcher:checkReleaseDuplicateClasses
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:generateReleaseBuildConfig
> Task :launcher:javaPreCompileRelease
> Task :launcher:checkReleaseAarMetadata
> Task :launcher:mergeReleaseShaders
> Task :launcher:compileReleaseShaders NO-SOURCE
> Task :launcher:generateReleaseAssets UP-TO-DATE
> Task :launcher:mergeReleaseAssets
> Task :launcher:processReleaseJavaRes NO-SOURCE
> Task :launcher:mergeReleaseJniLibFolders
> Task :launcher:writeReleaseAppMetadata
> Task :launcher:collectReleaseDependencies
> Task :launcher:bundleReleaseResources
> Task :launcher:configureReleaseDependencies
> Task :launcher:validateSigningRelease
> Task :launcher:parseReleaseIntegrityConfig
> Task :launcher:processReleaseManifestForPackage
> Task :unityLibrary:compileReleaseJavaWithJavac
> Task :launcher:processReleaseResources
> Task :unityLibrary:prepareReleaseArtProfile
> Task :unityLibrary:bundleLibRuntimeToJarRelease
> Task :unityLibrary:bundleLibCompileToJarRelease
> Task :launcher:compileReleaseJavaWithJavac
> Task :unityLibrary:mergeReleaseNativeLibs
> Task :unityLibrary:copyReleaseJniLibsProjectOnly
> Task :launcher:desugarReleaseFileDependencies
> Task :launcher:mergeReleaseJavaResource
> Task :launcher:dexBuilderRelease
> Task :launcher:mergeExtDexRelease FAILED
> Task :launcher:mergeReleaseArtProfile
50 actionable tasks: 50 executed
]
exit code: 1
Note: Recompile with -Xlint:deprecation for details. ERROR:D8: com.android.tools.r8.kotlin.H
FAILURE: Build completed with 2 failures.
@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 Level
Note: Recompile with -Xlint:deprecation for details. ERROR:D8: com.android.tools.r8.kotlin.H FAILURE: Build completed with 2 failures.
@Bestlis Your issue has already been reported googlesamples/unity-jar-resolver#703. As a workaround to fix it while Google investigates a real fix:
- Increase Minimum API Level to 24
Player Settings
>Other Settings
>Minimum API Level
Thanks! It works!))🎉
Note: Recompile with -Xlint:deprecation for details. ERROR:D8: com.android.tools.r8.kotlin.H FAILURE: Build completed with 2 failures.
@Bestlis Your issue has already been reported googlesamples/unity-jar-resolver#703. As a workaround to fix it while Google investigates a real fix:
- Increase Minimum API Level to 24
Player Settings
>Other Settings
>Minimum API Level
Unfortunately it still broken for me even with the above fixes. I'm on Unity 2021.3.42f1 with latest firebase version. This is the error log i'm getting:
This is actually inconsistent for me. It sometimes build successfully, but most of the time it will fail with the above error. Note here that these builds are being built using TeamCity for automation.
@vincent-savysoda, taking a quick glance at your logs, Firebase is not causing the issue.
ERROR:/Volumes/DataDrive/TeamCity/BuildAgent2/work/3af6105c011be877/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/project_dex_archive/release/out/com/savysoda/pixelStarships/BuildConfig.dex: D8: Type com.savysoda.pixelStarships.BuildConfig is defined multiple times: /Volumes/DataDrive/TeamCity/BuildAgent2/work/3af6105c011be877/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/project_dex_archive/release/out/com/savysoda/pixelStarships/BuildConfig.dex, /Volumes/DataDrive/TeamCity/BuildAgent2/work/3af6105c011be877/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/build/.transforms/28d612dd9ed4ab21a30f48890f321c60/transformed/release/com/savysoda/pixelStarships/BuildConfig.dex
[07:11:02] : [Step 2/3] com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
[07:11:02] : [Step 2/3] Type com.savysoda.pixelStarships.BuildConfig is defined multiple times: /Volumes/DataDrive/TeamCity/BuildAgent2/work/3af6105c011be877/Library/Bee/Android/Prj/IL2CPP/Gradle/launcher/build/intermediates/project_dex_archive/release/out/com/savysoda/pixelStarships/BuildConfig.dex, /Volumes/DataDrive/TeamCity/BuildAgent2/work/3af6105c011be877/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/build/.transforms/28d612dd9ed4ab21a30f48890f321c60/transformed/release/com/savysoda/pixelStarships/BuildConfig.dex
The issue is due to your code or setup that is causing the inconsistent build. Please file a new issue if you believe Firebase is this. Thanks!
Hi folks, the Firebase Unity SDK version 12.2.0
has 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 version 2021.3.42f1
. Please note that minimum API has to be set to level 24. That said, I'll go ahead and close this thread.
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:
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:
- Unity 2021.3.42f1.
- Firebase Unity SDK: 11.8.1
What gradle file did you change to support sdk 22?
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
Custom Gradle Properties:
Assets/Plugins/Android/gradleTemplate.properties
Reproducing the issue
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