googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.34k stars 1.09k forks source link

[build] Failed to transform play-services-measurement-api-22.0.0.aar #3397

Open dreamcodestudio opened 2 weeks ago

dreamcodestudio commented 2 weeks ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

  1. Setup Unity Environment by config:

Android Minimum API Level = 23 Android Target API Level = 34 Target platform = Android Scripting Backend = Mono API Level = .NET Standard 2.1

  1. Build in APK or AAB format

In result Unity shows Gradle build failed :

* What went wrong:
Execution failed for task ':launcher:mergeExtDexDebug'.
> Could not resolve all files for configuration ':launcher:debugRuntimeClasspath'.
   > Failed to transform play-services-measurement-api-22.0.0.aar (com.google.android.gms:play-services-measurement-api:22.0.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-incremental-transform=true, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: E:\Develop\Gradle_Custom_Cache\caches\transforms-2\files-2.1\e6412b3f412eb21e3a3fe30aa3f77d46\jetified-play-services-measurement-api-22.0.0-runtime.jar.
         > Error while dexing.
   > Failed to transform koin-core-jvm-3.5.3.jar (io.insert-koin:koin-core-jvm:3.5.3) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-incremental-transform=true, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingWithClasspathTransform: E:\Develop\Gradle_Custom_Cache\caches\transforms-2\files-2.1\8ec559f0e294fcb667680bde48958dc0\jetified-koin-core-jvm-3.5.3.jar.
         > Error while dexing.
   > Failed to transform koin-annotations-jvm-1.3.0.jar (io.insert-koin:koin-annotations-jvm:1.3.0) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-incremental-transform=true, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingWithClasspathTransform: E:\Develop\Gradle_Custom_Cache\caches\transforms-2\files-2.1\c95ba173d6118453dede757609d9a773\jetified-koin-annotations-jvm-1.3.0.jar.
         > Error while dexing.
   > Failed to transform kotlin-stdlib-1.9.21.jar (org.jetbrains.kotlin:kotlin-stdlib:1.9.21) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-incremental-transform=true, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.category=library, org.gradle.jvm.environment=standard-jvm, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingWithClasspathTransform: E:\Develop\Gradle_Custom_Cache\caches\transforms-2\files-2.1\0338abce55fea20d9562da3aa37e3c62\jetified-kotlin-stdlib-1.9.21.jar.
         > Error while dexing.
NVentimiglia commented 1 week ago

Hi, I was unable to replicate this issue. I installed the latest Google Mobile Ads plugin, the mentioned addapters, and made sure I executed the gradle integration guide on Unity 2021.

That said, your error mergeExtDexDebug comes from trying to import too much java code. Some things you can try:

Delete gradle caches Use R8 to minify. make sure you use multidex.

dreamcodestudio commented 1 week ago

Ok i try it on empty sandbox project and post the results

dreamcodestudio commented 4 days ago

On sandbox project i get errror:

> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > The minCompileSdk (34) specified in a
     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
     is greater than this module's compileSdkVersion (android-33).
     Dependency: androidx.webkit:webkit:1.11.0-alpha02.**
     **

New versions sdks requirment target Android API 34?

dreamcodestudio commented 4 days ago

But after set target API 34, sandbox build completed. I will collect more info in work project, maybe it collapse on some third-party plugins.

dreamcodestudio commented 4 days ago

On work project, build works fine after deleted Firebase Unity SDK, i will try update it to latest version v12.1.0

dreamcodestudio commented 4 days ago

About Firebase: image