AppLovin / AppLovin-MAX-Unity-Plugin

111 stars 31 forks source link

Applovin MAX Android Build Issue. "2 files found with path 'META-INF/kotlinx_coroutines_core.version' from inputs" #289

Closed muneebattamindravel closed 7 months ago

muneebattamindravel commented 8 months ago

MAX Plugin Version

5.11.3

Unity Version

2022.3.1f1

Device/Platform Info

Android

Current Behavior

  1. I simply added the Applovin MAX plugin "AppLovin-MAX-Unity-Plugin-5.11.3-Android-11.11.3-iOS-11.11.3.unitypackage"

  2. Opened the Integration Manager and added the SDK Key

  3. Built for Android

I get the following error:

stderr[ Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

Expected Behavior

The APK should be build without any issue.

How to Reproduce

  1. I simply added the Applovin MAX plugin "AppLovin-MAX-Unity-Plugin-5.11.3-Android-11.11.3-iOS-11.11.3.unitypackage"

  2. Opened the Integration Manager and added the SDK Key

  3. Built for Android

Additional Info

No response

marnelle1 commented 8 months ago
  1. Go to build settings -> publishing settings -> Check Custom Gradle Launcher Template
  2. Open launcherTemplate.gradle and type packaging { resources { pickFirst += "META-INF/kotlinx_coroutines_core.version" } } under android {

But I get another error now: [SafeDK-ERROR] Android variants not detected. Please make sure you place the directive: apply plugin: 'applovin' after you apply the Android plugin in your build.gradle file

muneebattamindravel commented 8 months ago

I was able to get the build working by doing the following (but not sure if this is the correct approach).

I did this on a mac and building with IL2CPP (not mono) in Unity:

  1. Goto project's root folder -> Library -> Bee -> Android -> Prj -> IL2CPP -> Gradle
  2. Delete all gradle related files in this folder

Screenshot 2023-10-04 at 9 11 12 PM

  1. Then go to unityLibrary and the launcher folders and open "build.gradle" files.

  2. In both of these files, in the packagingOptions add the following line: "exclude 'META-INF/kotlinx_coroutines_core.version'"

image

Doing this, started created my Android builds and build working fine on device.

However, this issue should be resolved at the plugin level.

NanaAmoah commented 8 months ago

Hi @muneebattamindravel and @marnelle1 this seems to be an issue with the latest Google AdMob SDK. Are you using v22.4.0.0 of the AdMob adapter? If you are, could you try using v22.3.0.0 instead to see if this resolves the issue?

marnelle1 commented 8 months ago

Hi @NanaAmoah ! Thanks for feedback. How can I downgrade the admob version?

image
marnelle1 commented 8 months ago

@NanaAmoah I tried to delete admob and it builds fine, but I need admob anyway

santoshbagadi commented 8 months ago

You can downgrade the adapter by updating the Android version in the MaxSdk/Mediation/Google/Editor/Dependencies.xml file to 22.3.0.0.

marnelle1 commented 8 months ago

You can downgrade the adapter by updating the iOS version in the MaxSdk/Mediation/Google/Editor/Dependencies.xml file to 22.3.0.0.

Thanks! That works great

farmme-tienld commented 6 months ago

@NanaAmoah Excuse me, this issue is not resolved. I'm using Unity 2022.3.11f1, AppLovin Intergration Manager 5.11.3. After install Facebook (android_6.16.0.2_ios_6.14.0.0), I meet this issue.

NanaAmoah commented 6 months ago

Hi @farmme-tienld, are you using AdMob in your app? Can you share a screenshot of your Unity integration manager and the build.gradle file in your exported Android project?

adizhavo commented 4 months ago

this issue still persists - any help / update on the thread pls

NanaAmoah commented 4 months ago

Hi @adizhavo Can you share a screenshot of your Unity integration manager and the build.gradle file in your exported Android project?