Hi, I’m trying to integrate Admob ads via IronSource extension on Android, the build finishes correctly, but fails on launch on device.
Here is the official instruction from IronSource: https://developers.ironsrc.com/ironsource-mobile/android/admob-mediation-guide/#step-4
Summary of required changes:
build.gradle
:
repositories {
maven {
url "http://dl.bintray.com/ironsource-mobile/android-adapters"
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads:18.3.0'
implementation 'com.ironsource.adapters:admobadapter:4.3.7@jar'
}
AndroidManifest.xml
:
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
The repro project can be found here:
- https://github.com/MaratGilyazov/def_ironsource/tree/mediation/admob_android
- and ZIP
- and resulting APK
Fails on start with such logs:
03-06 15:26:00.987 32446-32470/com.defironsource.test E/AndroidRuntime: FATAL EXCEPTION: Thread-5367
Process: com.defironsource.test, PID: 32446
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/R$string;
at com.google.android.gms.common.api.internal.GoogleServices.<init>(Unknown Source)
at com.google.android.gms.common.api.internal.GoogleServices.initialize(Unknown Source)
at com.google.android.gms.internal.measurement.zzx.zzf(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:44)
at com.google.android.gms.internal.measurement.zzx.<init>(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:22)
at com.google.android.gms.internal.measurement.zzx.zza(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:6)
at com.google.android.gms.measurement.api.AppMeasurementSdk.getInstance(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:2)
at com.google.android.gms.internal.ads.zzaku.zzd(com.google.android.gms:play-services-ads-lite@@18.3.0:43)
at com.google.android.gms.internal.ads.zzakt.run(com.google.android.gms:play-services-ads-lite@@18.3.0)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.R$string" on path: DexPathList[[zip file "/data/app/com.defironsource.test-2/base.apk"],nativeLibraryDirectories=[/data/app/com.defironsource.test-2/lib/arm, /data/app/com.defironsource.test-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.google.android.gms.common.api.internal.GoogleServices.<init>(Unknown Source)
at com.google.android.gms.common.api.internal.GoogleServices.initialize(Unknown Source)
at com.google.android.gms.internal.measurement.zzx.zzf(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:44)
at com.google.android.gms.internal.measurement.zzx.<init>(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:22)
at com.google.android.gms.internal.measurement.zzx.zza(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:6)
at com.google.android.gms.measurement.api.AppMeasurementSdk.getInstance(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:2)
at com.google.android.gms.internal.ads.zzaku.zzd(com.google.android.gms:play-services-ads-lite@@18.3.0:43)
at com.google.android.gms.internal.ads.zzakt.run(com.google.android.gms:play-services-ads-lite@@18.3.0)
at java.lang.Thread.run(Thread.java:818)
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.R$string
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 10 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
In the log I see different versions of com.google.android.gms
libs 17.1.0 and 18.3.0. The second one appeared from Admob dependencies requirement, so I guess the first one is set somewhere in Defold templates… Is this OK? Should I sync them? How?
Another guess - the error message says “Didn’t find class …” - can this be caused by proguard stripping? There were no instructions for proguard for Admob in IronSource, but I’m not sure if striping is enabled by default an if any extra configs needed here. (but there is proguard config from initial IS implementation, which already includes some directives for com.google.android.gms
)
Am I missing something? Any ideas how to fix?
Thanks!