I’m trying to develop native extension for AppLovin Max ads mediation (WIP Android only - AdColony, AppLovin, Pangle, Facebook, InMobi, Smaato, Tapjoy, Verizon, Vungle only adapters for now)
First, I want to say a “Great thank you” to @AGulev for Unity Ads and new-admob (which I use as template and example - I couldn’t have done anything without them).
And then I describe the problems faced while integrating ad-networks AAR-packages (and that may face anyone who will integrate ads mediation):
Java 8 Support (Smaato, Verizon) and element <queries> in <manifest>
(AdMob, InMobi, myTarget, Pangle)
Workaroud: Use Defold 1.2.181 BETA (or above) with D8 support
Facebook Ads
Got an runtime-error on ads initialization:
Can't load Audience Network Dex. Please, check that audience_network.dex is inside of assets folder.
java.io.FileNotFoundException: audience_network.dex
Related to #5710
Workaroud: Manually add custom assets to native extension resources. In my case - copy audience-network-sdk-6.3.0.aar/assets/audience_network.dex
to myextension/res/android/assets/audience_network.dex
.
(also already there is PR - thanks Defold devs for fast fix)
3rd party activity from ARR
Got an runtime-error while opening Mediation Debugger activity:
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.applovin.sdk.R$layout" on path: DexPathList[[zip file "/data/app/com.defold.applovinexample/base.apk"],nativeLibraryDirectories=[/data/app/com.defold.applovinexample/lib/arm, /data/app/com.defold.applovinexample/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /data/downloads, /data/priv-downloads]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
...
Workaroud: add package name to ext.manifest aaptExtraPackages section to force AAPT2 to generate R.class
file in package namespace. ('com.applovin.sdk'
in my case).
I’m not sure this is expected behaviour and I didn’t found this in navive extension manuals.
Mintegral (not solved)
Got an runtime-error on ads initialization:
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mintegral.msdk.out.MTGConfiguration" on path: DexPathList[[zip file "/data/app/com.defold.applovinexample/base.apk"],nativeLibraryDirectories=[/data/app/com.defold.applovinexample/lib/arm, /data/app/com.defold.applovinexample/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /data/downloads, /data/priv-downloads]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
...
Class com.mintegral.msdk.out.MTGConfiguration
is present in classes2.dex
(but not in main DEX) - seems related to legacy-multidex problem. Also this error may be related to Fb+Push issue
I tried to set minSdk=21 or change in manifest <application android:name="androidx.multidex.MultiDexApplication">
to avoid legacy-multidex but it didn’t help.
AdMob / Google Ad Manager and Applovin conflict (not solved)
com.applovin:applovin-sdk:10.1.2
and com.google.android.gms:play-services-ads:19.8.0
contains conflicting dependencies, got an D8 Compilation failed error:
Error in /tmp/.gradle/unpacked/com.google.android.gms-play-services-measurement-base-18.0.0.aar/classes.jar:com/google/android/gms/internal/measurement/zze.class:
Type com.google.android.gms.internal.measurement.zze is defined multiple times: /tmp/.gradle/unpacked/com.google.android.gms-play-services-measurement-base-18.0.0.aar/classes.jar:com/google/android/gms/internal/measurement/zze.class, /tmp/.gradle/unpacked/com.google.android.gms-play-services-measurement-impl-16.4.0.aar/classes.jar:com/google/android/gms/internal/measurement/zze.class
Compilation failed
I tried to play around ext.manifest aaptExcludePackages section, but looks like section is obsolete and I’ve got Error in 'extension-maxsdk/ext.manifest': Manifest context variable unsupported: aaptExcludePackages
.
myTarget (not solved)
Got an extender-error:
Missing 'package' key attribute on element package at [:com.my.target.mytarget-sdk-5.11.3:]
AndroidManifest Validation failed
Not sure but it may be related to manifest-merger version don’t support Android 11 specific manifests.
And I will be grateful for any clues how to solve problems above…