Could not find com.appodeal.ads.sdk

Unity: 2022 or higher  |  Appodeal SDK: 3.0.0 or higher

The error "launcher:checkReleaseDuplicateClasses'. > Could not resolve all dependencies for configuration ':launcher:releaseRuntimeClasspath > Could not find com.appodeal.ads.sdk.core:internal:3.0.2.' " happens because Unity switched to the new Android Gradle Plugin version (7.1.0). In this version, the repository setting was moved from the top-level build.gradle file to the setting.gradle file.

The error example from Unity Editor Log:

Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
   > Could not find com.appodeal.ads.sdk.core:internal:3.0.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/appodeal/ads/sdk/core/internal/3.0.2/internal-3.0.2.pom
       - https://repo.maven.apache.org/maven2/com/appodeal/ads/sdk/core/internal/3.0.2/internal-3.0.2.pom
       - file:/D:/UnityProjects/natrix/natrix/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/internal-3.0.2.jar
       - file:/D:/UnityProjects/natrix/natrix/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/libs/internal.jar
     Required by:
         project :launcher > project :unityLibrary

Workaround 

To solve the error please complete the following steps:

  1. Copy a settingsTemplate.gradle file from /Applications/Unity/Hub/Editor/2022.2.3f1/PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/settingsTemplate.gradle.

  2. Duplicate it to Assets/Plugins/Android/settingsTemplate.gradle. Now Unity can use the one from Assets/Plugins/Android.

    The settingsTemplate.gradle sample :

    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"
            }
        }
    }
  3. Copy the repositories block from dependencyResolutionManagement and safely delete dependencyResolutionManagement block from here.

    Now settingsTemplate.gradle should look like this:

    pluginManagement {
        repositories {
            **ARTIFACTORYREPOSITORY**
            gradlePluginPortal()
            google()
            mavenCentral()
        }
    }
    
    include ':launcher', ':unityLibrary'
    **INCLUDES**
  4. In Project Settings → Player → Publishing Settings for Android enable Custom Base Gradle Template and create allprojects block.

  5. Paste repositories copied in the settings template.

    As a result baseProjectTemplate.gradle will look like the one below:

    plugins {
        id 'com.android.application' version '7.1.2' apply false
        id 'com.android.library' version '7.1.2' apply false
        **BUILD_SCRIPT_DEPS**
    }
    
    allprojects {
        repositories {
            **ARTIFACTORYREPOSITORY**
            google()
            mavenCentral()
            flatDir {
                dirs "${project(':unityLibrary').projectDir}/libs"
            }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
  6. The build should succeed now.