Unity 2021.3 and Android build failure when using Android Legacy Libraries and target API 34

Hi folks,

We have been informed of build failures when including certain Plugins (such as Facebook and OneSignal) in Unity 2021 projects and targeting API 34. The error displayed is similar to:

> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Unexpected error during link, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.

This appears to be an AGP (Android Gradle Plugin) 4.x issue that has been fixed in newer AGP versions (7.2+). It is encountered when specific legacy libraries are added by 3rd-party plugins as dependencies to an Android Project, and the project targets API 34.

The libraries we have currently identified as problematic are:

  • androidx.legacy:legacy-support-v4:1.0.0
  • androidx.legacy:legacy-support-v13:1.0.0

We have not observed this issue with other AndroidX libraries.

What Unity is doing
For stability purposes, once a Unity version becomes LTS, we ā€˜lock’ Android tooling major versions over the LTS lifespan. This is a rare scenario where we have decided to ā€˜unlock’. Third-party plugins are still using these legacy libraries, and the AGP issue has not yet been fixed in 4.x.

As a result, we are updating the engine tooling for 2021.3 with high priority. The updated 2021.3 tooling will map 2022.3 also making the upgradeability between LTS versions smoother.

Changes:

  • Current 2021.3.40f1 tooling AGP 4.2.2 / Gradle 6.7.1 / Java 8
  • Upcoming 2021.3.XXf1 tooling AGP 7.4.2 / Gradle 7.5.1 / Java 11

If you are a game developer on Unity 2021 affected by the issue:
To test and target API 34 in the meantime

Option 1
Export your game as an Android Studio Project. Update the requirements to minimum AGP 7.2.0 / Gradle 7.2.0 / Java 11

Option 2
Evaluate whether these plugins are needed in your project and whether those library dependencies are actually used by those plugins.

If you are a plugin developer
Consider moving away from Android legacy libraries that have not been updated since 2018. Replace your products’ dependencies with androidX specific equivalents.

FAQ

When will the updated 2021 be released?
Because it involves a major Java/Gradle/AGP upgrade for the Engine, and the focus of an LTS is stability, we cannot commit yet to a definite release date. Our ambition is the next 2021 LTS patch (end of July 2024), given the engine’s stability is preserved. We will provide an update as soon as we can confirm.

Are any other Unity versions impacted by this issue?
No other supported Unity versions are impacted. We can confirm that Unity 2022 LTS and Unity 6 do not exhibit this behaviour. Unity 2020 or older are almost certainly affected.

The deadline for targeting API 34 is August 31 - what if I don’t have enough time?
We have informed Google about the impact of this AGP issue to Unity Creators. You are allowed to request an extension until November using the usual Google Play Console / Policy pages. Usually this opens around the beginning of August. Please mention Unity 2021 and AGP/Legacy Library issues in your extension request.

I am on 2021.3 but not affected by the issue - what do I need to do?
We recommend that users on LTS receive the latest patch releases. In this case, you can upgrade at your convenience. As this is a major update to Android tooling, please ensure your Templates, build setup, and integrations work as expected.

I’m on an unsupported version of Unity (2020 or older). What can I do?
Updates are no longer provided for these versions. We recommend either updating to a supported LTS stream or exporting your project to Android Studio and following Option 1 above.

Can I direct Unity to use a different version of Java/Gradle/AGP?
You can, through the Editor Preferences/External Tools, and Custom Android Templates. However in this case a different major Java version is required (11) by AGP 7.x. Unity releases are ā€˜locked’ to major compatible Java versions. Unity 2021 is currently locked to Java 8.x and changing to Java 11 will not work. The only alternative is to export to Android Studio.

20 Likes

Hello!

We installed 2021.3.41f1 on two Macs, and on both we’ve got

UnityException: JDK not found
Java Development Kit (JDK) directory is not set or invalid. Please, fix it in Edit / Unity -> Preferences -> External Tools

when building.

Also in External Tools we see warnings, though checkmarks are set to use Default tools:

How should we fix ā€œJDK not foundā€?

Hello,
For a few hours yesterday the Hub was serving the wrong files, it’s now been resolved.

If you are affected by this - follow these steps to get 2021.3.41f1 working again:

  • :wastebasket: Uninstall the previous Unity 2021.3.41f1.
  • :arrows_counterclockwise: Restart Unity Hub to refresh the cache and fetch the new Android tools versions.
  • :inbox_tray: Download Unity 2021.3.41f1 again.
2 Likes

Hello folks,

Unity 2021.3.41.f1 which was released yesterday, contains an update to tooling (tooling AGP 7.4.2 / Gradle 7.5.1 / Java 11) that fixes the aapt2 issue with Android Legacy Libraries. After these updates both 2022LTS and 2021LTS shared the same Android tools versions:

Tool Old - 2021.3.40f1 New - 2021.3.41f1
OpenJDK 1.8 11
Android Build Tools 30.0.2 32.0.0
Android Platform Tools 30.0.4 32.0.0
Android Gradle Plugin (AGP) 4.2.2 7.4.2
Gradle 6.7.1 7.5.1

We strongly recommend if you are affected to update to this patch.

Kind regards,
Android Platform team

3 Likes

Hello,
I can’t make build with Unity 2021.3.41f1 and firebase sdk 12.1.0.
Target API Level: 34
Minimum API Level: 23

Could you please check it

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.
2 Likes

This fixed my issue:

But now I have issue similar to issue that unity_A1D21602CC961602549B reported:
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.

We also have

Target API Level: 34
Minimum API Level: 23
1 Like

@Petr77777 @unity_A1D21602CC961602549B

Are you using custom Android templates? If so, could you please share it with us? The locations for these templates are:

  • Assets/Plugin/Android/mainTemplate.gradle
  • Assets/Plugin/Android/launcherTemplate.gradle

Make sure ndkPath **NDKPATH** it’s present in your .gradle templates:

android {
    ...
    ndkPath "**NDKPATH**"
    ...
}

Yes, I enabled custom Android templates. Here is mine

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, Assets/Firebase/Editor/RemoteConfigDependencies.xml:20
        }
        maven {
            url "https://maven.google.com/" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7, Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:12, Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
        }
        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 'androidx.constraintlayout:constraintlayout:2.1.4' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:12
    implementation 'com.google.android.gms:play-services-ads:23.2.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    implementation 'com.google.android.gms:play-services-base:18.5.0' // Assets/Firebase/Editor/AppDependencies.xml:17
    implementation 'com.google.android.ump:user-messaging-platform:2.2.0' // Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
    implementation 'com.google.firebase:firebase-analytics:22.0.2' // Assets/Firebase/Editor/RemoteConfigDependencies.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
    implementation 'com.google.firebase:firebase-config:22.0.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:13
    implementation 'com.google.firebase:firebase-config-unity:12.1.0' // Assets/Firebase/Editor/RemoteConfigDependencies.xml:20
// Android Resolver Dependencies End
**DEPS**}

// 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 {
    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**

launcherTemplate.gradle

apply plugin: 'com.android.application'

dependencies {
    implementation project(':unityLibrary')
    }

android {
    namespace "**NAMESPACE**"
    ndkPath "**NDKPATH**"
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        applicationId '**APPLICATIONID**'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
    }

    aaptOptions {
        noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**SIGN**

    lintOptions {
        abortOnError false
    }

    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
**BUILT_APK_LOCATION**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**

Try doing two things:

  • Clean build
  • Resolve Jar Dependencies again with EDM4U:
    • Assets > External Dependency Manager > Android Resolver > Force Resolve

I created empty project, import only google mobile ads, firebase and have same build error. I can build success only if I remove firebase sdk. But If I use unity 2021.3.40f1, I can build success with firebase sdk (Minimum API Level: 24)

I’ll investigate what’s happening. I was able to reproduce following your steps:

1 Like

I am having the same error for lots of libraries.
Unity 2021.3.41f1
TargetSdkVersion 34

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':launcher:debugRuntimeClasspath'.
   > Could not find com.ironsource.adapters:admobadapter:4.3.41.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/admobadapter/4.3.41/admobadapter-4.3.41.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/admobadapter/4.3.41/admobadapter-4.3.41.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/admobadapter-4.3.41.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/admobadapter.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.adapters:applovinadapter:4.3.41.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/applovinadapter/4.3.41/applovinadapter-4.3.41.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/applovinadapter/4.3.41/applovinadapter-4.3.41.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/applovinadapter-4.3.41.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/applovinadapter.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.adapters:bidmachineadapter:4.3.6.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/bidmachineadapter/4.3.6/bidmachineadapter-4.3.6.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/bidmachineadapter/4.3.6/bidmachineadapter-4.3.6.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/bidmachineadapter-4.3.6.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/bidmachineadapter.jar
     Required by:
         project :launcher
   > Could not find io.bidmachine:ads:2.5.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/io/bidmachine/ads/2.5.2/ads-2.5.2.pom
       - https://repo.maven.apache.org/maven2/io/bidmachine/ads/2.5.2/ads-2.5.2.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/ads-2.5.2.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/ads.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.adapters:chartboostadapter:4.3.15.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/chartboostadapter/4.3.15/chartboostadapter-4.3.15.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/chartboostadapter/4.3.15/chartboostadapter-4.3.15.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/chartboostadapter-4.3.15.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/chartboostadapter.jar
     Required by:
         project :launcher
   > Could not find com.chartboost:chartboost-sdk:9.6.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/chartboost/chartboost-sdk/9.6.1/chartboost-sdk-9.6.1.pom
       - https://repo.maven.apache.org/maven2/com/chartboost/chartboost-sdk/9.6.1/chartboost-sdk-9.6.1.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/chartboost-sdk-9.6.1.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/chartboost-sdk.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.adapters:facebookadapter:4.3.46.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/facebookadapter/4.3.46/facebookadapter-4.3.46.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/facebookadapter/4.3.46/facebookadapter-4.3.46.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/facebookadapter-4.3.46.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/facebookadapter.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.adapters:fyberadapter:4.3.30.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/fyberadapter/4.3.30/fyberadapter-4.3.30.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/fyberadapter/4.3.30/fyberadapter-4.3.30.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/fyberadapter-4.3.30.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/fyberadapter.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.adapters:hyprmxadapter:4.3.8.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/hyprmxadapter/4.3.8/hyprmxadapter-4.3.8.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/hyprmxadapter/4.3.8/hyprmxadapter-4.3.8.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/hyprmxadapter-4.3.8.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/hyprmxadapter.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.sdk:mediationsdk:8.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/sdk/mediationsdk/8.0.0/mediationsdk-8.0.0.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/sdk/mediationsdk/8.0.0/mediationsdk-8.0.0.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mediationsdk-8.0.0.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mediationsdk.jar
     Required by:
         project :launcher
   > Could not find com.ironsource:adqualitysdk:7.19.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adqualitysdk/7.19.1/adqualitysdk-7.19.1.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adqualitysdk/7.19.1/adqualitysdk-7.19.1.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/adqualitysdk-7.19.1.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/adqualitysdk.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.unity:adqualitysdk:7.19.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/unity/adqualitysdk/7.19.1/adqualitysdk-7.19.1.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/unity/adqualitysdk/7.19.1/adqualitysdk-7.19.1.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/adqualitysdk-7.19.1.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/adqualitysdk.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.adapters:mintegraladapter:4.3.17.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/mintegraladapter/4.3.17/mintegraladapter-4.3.17.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/mintegraladapter/4.3.17/mintegraladapter-4.3.17.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mintegraladapter-4.3.17.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mintegraladapter.jar
     Required by:
         project :launcher
   > Could not find com.mbridge.msdk.china:mbbid:16.4.62.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mbridge/msdk/china/mbbid/16.4.62/mbbid-16.4.62.pom
       - https://repo.maven.apache.org/maven2/com/mbridge/msdk/china/mbbid/16.4.62/mbbid-16.4.62.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mbbid-16.4.62.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mbbid.jar
     Required by:
         project :launcher
   > Could not find com.mbridge.msdk.china:reward:16.4.62.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mbridge/msdk/china/reward/16.4.62/reward-16.4.62.pom
       - https://repo.maven.apache.org/maven2/com/mbridge/msdk/china/reward/16.4.62/reward-16.4.62.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/reward-16.4.62.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/reward.jar
     Required by:
         project :launcher
   > Could not find com.mbridge.msdk.china:mbbanner:16.4.62.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mbridge/msdk/china/mbbanner/16.4.62/mbbanner-16.4.62.pom
       - https://repo.maven.apache.org/maven2/com/mbridge/msdk/china/mbbanner/16.4.62/mbbanner-16.4.62.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mbbanner-16.4.62.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/mbbanner.jar
     Required by:
         project :launcher
   > Could not find com.mbridge.msdk.china:newinterstitial:16.4.62.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/mbridge/msdk/china/newinterstitial/16.4.62/newinterstitial-16.4.62.pom
       - https://repo.maven.apache.org/maven2/com/mbridge/msdk/china/newinterstitial/16.4.62/newinterstitial-16.4.62.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/newinterstitial-16.4.62.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/newinterstitial.jar
     Required by:
         project :launcher
   > Could not find com.ironsource.adapters:pangleadapter:4.3.26.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/ironsource/adapters/pangleadapter/4.3.26/pangleadapter-4.3.26.pom
       - https://repo.maven.apache.org/maven2/com/ironsource/adapters/pangleadapter/4.3.26/pangleadapter-4.3.26.pom
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/pangleadapter-4.3.26.jar
       - file:/Users/sametg/Projects/battle-towers/UnitySDK/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/pangleadapter.jar
1 Like

This is an issue with EDM4U not being updated for 2021.3.41f1. In order to temporaly fix it while we wait for EDM4U to get updated:

  1. Create a settingsTemplate.gradle file inside Assets/Plugin/Android/ and paste this contents:
pluginManagement {
    repositories {
        **ARTIFACTORYREPOSITORY**
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

include ':launcher', ':unityLibrary'
**INCLUDES**

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        **ARTIFACTORYREPOSITORY**
        google()
        mavenCentral()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

  1. Go to mainTemplate.gradle and copy the repositories inside project.repositories { ... }
  2. Then go to your settingsTemplate.gradle file and paste it inside dependencyResolutionManagement, after **ARTIFACTORYREPOSITORY**. It should look something like this:

pluginManagement {
    repositories {
        **ARTIFACTORYREPOSITORY**
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

include ':launcher', ':unityLibrary'
**INCLUDES**

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        **ARTIFACTORYREPOSITORY**
// Copied from mainTemplate.gradle
// Android Resolver Repos Start
        maven {
            url "https://maven.google.com"
        }
        maven {
            url "file:////<DIR_TO_YOR_PROJECT>/Assets/GeneratedLocalRepo/Firebase/m2repository"
        }
        maven {
            url "https://maven.google.com/" 
        }
// Android Resolver Repos End
        google()
        mavenLocal()
        mavenCentral()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}
1 Like

Thank you,
Your solution worked but I have to increase Minimum API Level to 24. Is this normal?

What if I don’t use EDM4U? Currently I don’t have it in my project and I don’t plan to have it.
So Unity is dependent on 3rd party plugin in order to function properly?

1 Like

You’ll only face this issue if you are using a EDM4U. If you are not using EDM4U, just put your repositories inside settingsTemplate.gradle in dependencyResolutionManagement as explained in my message above.

Do you know if Unity will do anything about this issue before 31th August?
I am not sure if I should wait for an updated version of Unity that works out of the box or just apply these workarounds.

When I applied your workaround it works!

If you are not using EDM4U, but you have third-party SDKs, having the repositories in settingsTemplate.gradle it’s not a workaround. This is required by Gradle 7+ (docs).

However, we will look into making it easier to create settingsTemplate.gradle from the UI, we will keep you posted.

1 Like