Ad mediation Break my Android builds

after I add the ad mediation to an empty project it freezes Unity when I try to do a build for the Android

and if I try to use force resolve the resolver stuck on 0 % and I get this error
the same thing happen in my other computer

Win32Exception:

ApplicationName='C:\Unity\Myproject(9)\Temp\PlayServicesResolverGradle\gradlew.bat', CommandLine='--no-daemon -b "C:\Unity\Myproject(9)\Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.gradle" "-PANDROID_HOME=C:/Unity/unityVer/2022.3.47f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK" "-PTARGET_DIR=C:\Unity\Myproject(9)\Assets\Plugins\Android" "-PMAVEN_REPOS=https://android-sdk.is.com/;https://maven.google.com/" "-PPACKAGES_TO_COPY=com.ironsource.sdk:mediationsdk:8.3.0;com.google.android.gms:play-services-ads-identifier:18.0.1;com.google.android.gms:play-services-basement:18.1.0" "-PUSE_JETIFIER=0" "-PDATA_BINDING_VERSION=7.4.2"', CurrentDirectory='C:\Unity\Myproject(9)\Temp\PlayServicesResolverGradle', Native error= The system cannot find the file specified.

System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at <b665a8ea08a24cdcbf55a3574a742718>:0)
System.Diagnostics.Process.Start () (at <b665a8ea08a24cdcbf55a3574a742718>:0)
(wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
GooglePlayServices.CommandLine.RunViaShell (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler, System.Boolean useShellExecution, System.Boolean stdoutRedirectionInShellMode) (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0)
GooglePlayServices.CommandLine.Run (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] envVars, GooglePlayServices.CommandLine+IOHandler ioHandler) (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0)
GooglePlayServices.CommandLine+<RunAsync>c__AnonStorey0.<>m__1 () (at <6107d0e161ea44f5b1a06a3cb63d4bc0>:0)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <31ddbb77ad66410c97138ec8b16c1d8f>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <31ddbb77ad66410c97138ec8b16c1d8f>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <31ddbb77ad66410c97138ec8b16c1d8f>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <31ddbb77ad66410c97138ec8b16c1d8f>:0)
System.Threading.ThreadHelper.ThreadStart () (at <31ddbb77ad66410c97138ec8b16c1d8f>:0)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs)

Moved you to LevelPlay section

1 Like

My solution for AR Masker in building with Unity Ads Mediation/LevelPlay/ironSource was to:

  1. Delete this line from mainTemplate.gradle file:
maven {
    url "https://maven.google.com"
}
  1. Add this line to settingsTemplate.gradle file in dependencyResolutionManagement to repositories section:
        maven {
    url "https://android-sdk.is.com/" // Assets/LevelPlay/Editor/IronSourceAdQualityDependencies.xml:9, Assets/LevelPlay/Editor/IronSourceSDKDependencies.xml:9, Assets/LevelPlay/Editor/ISUnityAdsAdapterDependencies.xml:8
}

To use these files, you need to enable them in the build section on the screenshot in Publishing Settings of Player Settings:

This is the final result of settingsTemplate.gradle:

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

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

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        **ARTIFACTORYREPOSITORY**
        google()
        mavenCentral()
        maven {
            url "https://android-sdk.is.com/" // Assets/LevelPlay/Editor/IronSourceAdQualityDependencies.xml:9, Assets/LevelPlay/Editor/IronSourceSDKDependencies.xml:9, Assets/LevelPlay/Editor/ISUnityAdsAdapterDependencies.xml:8
        }
// Android Resolver Repos Start
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        mavenLocal()
// Android Resolver Repos End
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}