Mike Pandolfini
Mike Pandolfini

Reputation: 21

Unity Ads with Mediation causes Android builds to fail

When I install "Advertisement with Mediation (ver. 1.5.0)" in a project, I can no longer build for Android.

This applies to new, empty projects as well as legacy projects.

The following error message appears: “…It looks like there are a few files missing from Assets\Plugins\Android. You can fix this by resolving dependencies again…”

When I click Resolve, the build process starts right away and hangs. I have to force quit Unity. If I don’t click Resolve, the build hangs up on building the first scene in the project and I have to force quit.

Nothing at all happens via Assets -> Mobile Dependency Resolver -> Android Resolver -> Force Resolver.

I am using Unity 2021.3.13.

Does anyone know what is occurring and how to fix it?

I attempted to resolve as stated in the pop up and it causes Unity to hang. I attempted to resolve beforehand and it appears to do nothing.

I attempted to delete my library folder and it had no effect on reimport.

I attempted to export the project, and the project hangs.

Upvotes: 1

Views: 3542

Answers (4)

1ly4s0
1ly4s0

Reputation: 94

For anyone having this problem, seems like the "gradlew.bat" file is not been created in the Temp folder, so I've downloaded it from here:

https://github.com/googlesamples/unity-jar-resolver/blob/master/gradlew.bat and placed on the Temp\PlayServicesResolverGradle folder, but I still don't know why this is happening and how to permanently fix it, but at least you will be able to install and configure the ads Mediation, I did it here and worked.

Upvotes: 3

crazydaze
crazydaze

Reputation: 29

What David Laing mentioned helped me. I didn't realize the gradlew.bat needed to be dragged into the appropriate folder as I thought the Edit -> Preferences -> Gradle Installed with Unity address needed to be corrected.

That being said. This is where you can find the official gradle distributions: https://services.gradle.org/distributions/

  1. Find the gradle-8.3-rc-4-src.zip or the most recent edition. The important part is the "SRC.zip" as that contains the actual gradlew.bat file The others are documents and an SHA file.
  2. Extract the file to your desired location.
  3. Open the folder that was extracted.
  4. Copy gradlew.bat NOTE:: MAKE SURE IT'S THE "WINDOWS BATCH FILE" FILE TYPE NOT THE "FILE" type as there are 2 files with the exact name in the folder.
  5. Paste the gradlew.bat file to the first folder path it mentions where the gradlew.bat file is missing.
  6. Launch or cause Unity to compile again, and the android resolver should now work.

Upvotes: 1

David Laing
David Laing

Reputation: 11

I have a similar issue with both Unity Ads with Mediation and the newer Ironsource Ads Mediation(com.unity.services.levelplay). When I run Assets -> Mobile Dependency Resolver -> Android Resolver -> Resolve I get the following error on the console: Win32Exception: ApplicationName='C:\Users\D\Documents\app\Test\Temp\PlayServicesResolverGradle\gradlew.bat', CommandLine='--daemon -b "C:\Users\D\Documents\app\Test\Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.gradle" "-PANDROID_HOME=C:/Program Files/Unity/Hub/Editor/2021.3.14f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK" "-PTARGET_DIR=C:\Users\D\Documents\app\Test\Assets\Plugins\Android" "-PMAVEN_REPOS=https://android-sdk.is.com/;https://maven.google.com/" "-PPACKAGES_TO_COPY=com.ironsource.sdk:mediationsdk:7.2.5;com.google.android.gms:play-services-ads-identifier:17.0.0;com.google.android.gms:play-services-basement:17.2.1" "-PUSE_JETIFIER=0" "-PDATA_BINDING_VERSION=4.0.1"', CurrentDirectory='C:\Users\D\Documents\app\Test\Temp\PlayServicesResolverGradle', Native error= The system cannot find the file specified.

The file gradlew.bat doesn't exist. I found a gradlew.bat here: https://github.com/googlesamples/unity-jar-resolver. I copied the file into: C:\Users\D\Documents\app\Test\Temp\PlayServicesResolverGradle and then I could run the the resolver from Unity.

But it leads to this questions: Why does Unity MobileDependencyResolver not create gradlew.bat? It does create gradlew, the gradle start up script for Unix. Why the Unix script and not the Windows script?

Upvotes: 1

Mike Pandolfini
Mike Pandolfini

Reputation: 21

Advertisement with Mediation is not being properly supported by Unity anymore post IronSource merger. They suggest using Ironsource’s mediation platform. We use AdMob given I already know how to deal with its obvious bugs.

Upvotes: 0

Related Questions