Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'. When build with Unity 2021.3.41

After using Unity 2021.3.41, the AAPT2 issue is fixed, but I encountered a new bug (1). I think it is caused by the new AGP versions. After performing the following steps:

  1. Copy settingsTemplate.gradle from

Unity\Hub\Editor\2021.3.41f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates
to Plugin/Android.

  1. Delete dependencyResolutionManagement block in settingsTemplate.gradle
  2. Add all my repositories into settingsTemplate.gradle
  3. Force Resolve with EDM4U
  4. Build Project.
    Then the bugs change to (2).
    All this bugs is appear with warning:

WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 34

Plugins in my project:

  • IronSource: 7.5.1
  • GoogleMobileAds: 8.5.1
  • Firebase: 11.0.0
FAILURE: Build completed with 3 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'.
   > Could not find com.google.firebase:firebase-analytics-unity:11.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-analytics-unity/11.0.0/firebase-analytics-unity-11.0.0.pom
       - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-analytics-unity/11.0.0/firebase-analytics-unity-11.0.0.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-analytics-unity-11.0.0.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/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:11.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-app-unity/11.0.0/firebase-app-unity-11.0.0.pom
       - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-app-unity/11.0.0/firebase-app-unity-11.0.0.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-app-unity-11.0.0.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-app-unity.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.google.firebase:firebase-config-unity:11.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-config-unity/11.0.0/firebase-config-unity-11.0.0.pom
       - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-config-unity/11.0.0/firebase-config-unity-11.0.0.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-config-unity-11.0.0.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-config-unity.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.google.firebase:firebase-crashlytics-unity:11.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-crashlytics-unity/11.0.0/firebase-crashlytics-unity-11.0.0.pom
       - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-crashlytics-unity/11.0.0/firebase-crashlytics-unity-11.0.0.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-crashlytics-unity-11.0.0.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-crashlytics-unity.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.google.firebase:firebase-firestore-unity:11.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-firestore-unity/11.0.0/firebase-firestore-unity-11.0.0.pom
       - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-firestore-unity/11.0.0/firebase-firestore-unity-11.0.0.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-firestore-unity-11.0.0.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-firestore-unity.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.google.firebase:firebase-messaging-unity:11.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-messaging-unity/11.0.0/firebase-messaging-unity-11.0.0.pom
       - https://repo.maven.apache.org/maven2/com/google/firebase/firebase-messaging-unity/11.0.0/firebase-messaging-unity-11.0.0.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-messaging-unity-11.0.0.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/firebase-messaging-unity.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:admobadapter:4.3.39.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/admobadapter/4.3.39/admobadapter-4.3.39.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/admobadapter/4.3.39/admobadapter-4.3.39.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/admobadapter-4.3.39.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/admobadapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:applovinadapter:4.3.39.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/applovinadapter/4.3.39/applovinadapter-4.3.39.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/applovinadapter/4.3.39/applovinadapter-4.3.39.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/applovinadapter-4.3.39.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/applovinadapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:facebookadapter:4.3.45.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/facebookadapter/4.3.45/facebookadapter-4.3.45.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/facebookadapter/4.3.45/facebookadapter-4.3.45.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/facebookadapter-4.3.45.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/facebookadapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:fyberadapter:4.3.27.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/fyberadapter/4.3.27/fyberadapter-4.3.27.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/fyberadapter/4.3.27/fyberadapter-4.3.27.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/fyberadapter-4.3.27.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/fyberadapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:inmobiadapter:4.3.18.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/inmobiadapter/4.3.18/inmobiadapter-4.3.18.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/inmobiadapter/4.3.18/inmobiadapter-4.3.18.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/inmobiadapter-4.3.18.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/inmobiadapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:mintegraladapter:4.3.18.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/mintegraladapter/4.3.18/mintegraladapter-4.3.18.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/mintegraladapter/4.3.18/mintegraladapter-4.3.18.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mintegraladapter-4.3.18.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mintegraladapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:pangleadapter:4.3.21.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/pangleadapter/4.3.21/pangleadapter-4.3.21.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/pangleadapter/4.3.21/pangleadapter-4.3.21.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/pangleadapter-4.3.21.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/pangleadapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:unityadsadapter:4.3.31.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/unityadsadapter/4.3.31/unityadsadapter-4.3.31.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/unityadsadapter/4.3.31/unityadsadapter-4.3.31.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/unityadsadapter-4.3.31.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/unityadsadapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.adapters:vungleadapter:4.3.21.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/vungleadapter/4.3.21/vungleadapter-4.3.21.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/vungleadapter/4.3.21/vungleadapter-4.3.21.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/vungleadapter-4.3.21.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/vungleadapter.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.ironsource.sdk:mediationsdk:7.5.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/sdk/mediationsdk/7.5.1/mediationsdk-7.5.1.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/sdk/mediationsdk/7.5.1/mediationsdk-7.5.1.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mediationsdk-7.5.1.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mediationsdk.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.mbridge.msdk.oversea:mbbanner:16.5.11.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mbridge/msdk/oversea/mbbanner/16.5.11/mbbanner-16.5.11.pom
       - https://repo.maven.apache.org/maven2/com/mbridge/msdk/oversea/mbbanner/16.5.11/mbbanner-16.5.11.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mbbanner-16.5.11.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mbbanner.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.mbridge.msdk.oversea:mbbid:16.5.11.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mbridge/msdk/oversea/mbbid/16.5.11/mbbid-16.5.11.pom
       - https://repo.maven.apache.org/maven2/com/mbridge/msdk/oversea/mbbid/16.5.11/mbbid-16.5.11.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mbbid-16.5.11.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mbbid.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.mbridge.msdk.oversea:newinterstitial:16.5.11.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mbridge/msdk/oversea/newinterstitial/16.5.11/newinterstitial-16.5.11.pom
       - https://repo.maven.apache.org/maven2/com/mbridge/msdk/oversea/newinterstitial/16.5.11/newinterstitial-16.5.11.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/newinterstitial-16.5.11.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/newinterstitial.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.mbridge.msdk.oversea:reward:16.5.11.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mbridge/msdk/oversea/reward/16.5.11/reward-16.5.11.pom
       - https://repo.maven.apache.org/maven2/com/mbridge/msdk/oversea/reward/16.5.11/reward-16.5.11.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/reward-16.5.11.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/reward.jar
     Required by:
         project :launcher > project :unityLibrary
   > Could not find com.pangle.global:ads-sdk:5.4.0.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/pangle/global/ads-sdk/5.4.0.2/ads-sdk-5.4.0.2.pom
       - https://repo.maven.apache.org/maven2/com/pangle/global/ads-sdk/5.4.0.2/ads-sdk-5.4.0.2.pom
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/ads-sdk-5.4.0.2.jar
       - file:/E:/Unity-Work/Dreamy/Stickman Falling/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/ads-sdk.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:11.0.0.
     Required by:
         project :unityLibrary
   > Could not find com.google.firebase:firebase-app-unity:11.0.0.
     Required by:
         project :unityLibrary
   > Could not find com.google.firebase:firebase-config-unity:11.0.0.
     Required by:
         project :unityLibrary
   > Could not find com.google.firebase:firebase-crashlytics-unity:11.0.0.
     Required by:
         project :unityLibrary
   > Could not find com.google.firebase:firebase-firestore-unity:11.0.0.
     Required by:
         project :unityLibrary
   > Could not find com.google.firebase:firebase-messaging-unity:11.0.0.
     Required by:
         project :unityLibrary
   > Could not find com.ironsource.adapters:admobadapter:4.3.39.
     Required by:
         project :unityLibrary
   > Could not find com.ironsou<message truncated>

After:


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'.
   > Could not find :simple-android-notifications:.
     Required by:
         project :launcher > project :unityLibrary
   > Could not find :IngameDebugConsole:.
     Required by:
         project :launcher > project :unityLibrary
   > Could not find :common:.
     Required by:
         project :launcher > project :unityLibrary
   > Could not find :NativeGallery:.
     Required by:
         project :launcher > project :unityLibrary
   > Could not find :firebase-messaging-cpp:.
     Required by:
         project :launcher > project :unityLibrary
   > Could not find :googlemobileads-unity:.
     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.

Please don’t use the 2D-Physics tag on a post that has nothing whatsoever to do with 2D-Physics. Taghs are used to find relevant posts and this makes it that much more difficult.

I’ll rmove the tag.

Thanks.

Thank you for bringing this to my attention. I apologize for the incorrect tagging and any inconvenience it may have caused. I’ll be more careful with tagging in the future.

Thanks again for your understanding.

Unity 2021.3 and Android build failure when using Android Legacy Libraries and target API 34 - #58 by manugil

Follow these steps to solve the checkReleaseDuplicateClasses issue:

  1. Download the latest Unity 2021.3.42f1
  2. Update External Dependency Manager to 1.2.182:
  3. Assets > External Dependency Manager > Android > Force Resolve Dependencies
  4. Increase Minimum API Level to 24 (EDM4U issue)
    • Player Settings > Other Settings > Minimum API Level
    • This is needed to solve ERROR:D8: com.android.tools.r8.kotlin.H
    • Google is aware of the issue and they are investigating it: unity-jar-resolver/issues/703
  5. Build

Google had figured out that the problem(minSDKVersion has to be raised to 24) happens when using Gradle7.5.1 and AGP7.4.2, and it will be solved using Gradle and AGP 8+. Till that wo can only check Project Settings > Publishing Settings > Minify > Release and customize our proguard-users.txt.
So could your investigate this?
https://github.com/googlesamples/unity-jar-resolver/issues/703

There seems to be a workaround for it until Google fixes it, let us know if it works for you:

  1. Create a custom baseProjectTemplate.gradle
    • Player Settings > Publishing > Create Custom Base Gradle Template
  2. Open newly created Assets/Plugins/Android/baseProjectTemplate.gradle.
  3. Force use of a newer r8 version
buildscript {
    repositories {
        maven {
            url = uri("https://storage.googleapis.com/r8-releases/raw")
        }
    }
    dependencies {
        classpath("com.android.tools:r8:8.3.37")
    }
}

source: [Bug] [Android] Kotlin error on Unity 2021.3.41f1 · Issue #703 · googlesamples/unity-jar-resolver · GitHub