Android Question FirebaseAdMob Issue (LoadAdWithTestDevice) [SOLVED]

artsoft

Active Member
Licensed User
Longtime User
Hi!

After fixing many things today regarding SDKManager, missing libs, DEX issues and so on ....
now I am faced with the follwing, new issue:

I can compile my app without any problems - so far so good,
but while runtime while trying to show my activiy with my normal AdBanner ...

B4X:
Private BannerAd As AdView

... I get every time this exception:

java.lang.NoSuchMethodError: No virtual method addTestDevice(Ljava/lang/String;)Lcom/google/android/gms/ads/AdRequest$Builder; in class Lcom/google/android/gms/ads/AdRequest$Builder; or its super classes (declaration of 'com.google.android.gms.ads.AdRequest$Builder' appears in /data/app/de.padlockblue.manager-rlxyQEL7PreeBAQXnaDgBg==/base.apk)
at anywheresoftware.b4a.admobwrapper.AdViewWrapper.LoadAdWithTestDevice(AdViewWrapper.java:152)
at de.padlockblue.manager.masterinput._initbannerobjects(masterinput.java:651)
at de.padlockblue.manager.masterinput$ResumableSub_Activity_Create.resume(masterinput.java:624)
at de.padlockblue.manager.masterinput._activity_create(masterinput.java:416)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at de.padlockblue.manager.masterinput.afterFirstLayout(masterinput.java:110)
at de.padlockblue.manager.masterinput.access$000(masterinput.java:22)
at de.padlockblue.manager.masterinput$WaitForLayout.run(masterinput.java:88)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7830)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040)


So, I guess there was a replacement of a lib or something like this.
Any idea, what to do in such a case?

I am using this in order to see real AD BANNERS - provided from google - but not to pay with it - because the TESTDEVICE ID is given and inserted in this method as a parameter from B4A log.

Using admob 2:

2021-04-13 15_23_20-PADLOCKblue - B4A.png


Using method: LoadWithTestDevice (with my own device ID):

2021-04-13 15_23_39-PADLOCKblue - B4A.png


Regards
ARTsoft
 
Last edited:

artsoft

Active Member
Licensed User
Longtime User
Within the unfiltered log I found this - before the exception above:

unable to use native MDCL: falling back to Java impl
java.lang.RuntimeException: Invalid API Level
at com.facebook.common.dextricks.MultiDexClassLoaderArtNative.init(Native Method)
at com.facebook.common.dextricks.MultiDexClassLoaderArtNative.<init>(Unknown Source:71)
at com.facebook.common.dextricks.MultiDexClassLoader.createMultiDexClassLoader(Unknown Source:71)
at com.facebook.common.dextricks.MultiDexClassLoader.install(Unknown Source:93)
at com.facebook.common.dextricks.DexStore.loadDexFiles(Unknown Source:146)
at com.facebook.common.dextricks.DexStore.loadAllImpl(Unknown Source:903)
at com.facebook.common.dextricks.DexStore.loadAll(Unknown Source:1)
at com.facebook.common.dextricks.DexLibLoader.loadAllImpl(Unknown Source:377)
at com.facebook.common.dextricks.DexLibLoader.loadAll(Unknown Source:13)
at com.facebook.common.dextricks.DexLibLoader.loadAll:)268435460)
at com.facebook.messenger.app.MessengerApplication.A02(Unknown Source:4387)
at X.003.A04(Unknown Source:5)
at X.05D.run(Unknown Source:13)
Comparing new 1617811802501 to old 1617811802501
Class com.google.android.gms.ads.VideoController failed lock verification and will run slower.
Class com.google.android.gms.internal.ads.zzzz failed lock verification and will run slower.
Abort hooks installed successfully
java.lang.NoSuchMethodError: No virtual method addTestDevice(Ljava/lang/String;)Lcom/google/android/gms/ads/AdRequest$Builder; in class Lcom/google/android/gms/ads/AdRequest$Builder; or its super classes (declaration of 'com.google.android.gms.ads.AdRequest$Builder' appears in /data/app/de.padlockblue.manager-rlxyQEL7PreeBAQXnaDgBg==/base.apk)
at anywheresoftware.b4a.admobwrapper.AdViewWrapper.LoadAdWithTestDevice(AdViewWrapper.java:152)


This is again a DEXER issue, I guess, which could trigger the addTestDevice issue perhaps.

Any idea?

Regards
ARTsoft
 
Last edited:
Upvote 0

artsoft

Active Member
Licensed User
Longtime User
When I use this normal method from admob ...

B4X:
BannerAd.LoadAd

... then I get this runtime error:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/InterstitialAd;
at anywheresoftware.b4a.admobwrapper.AdViewWrapper$InterstitialAdWrapper.Initialize(AdViewWrapper.java:307)
at de.padlockblue.manager.masterinput._initbannerobjects(masterinput.java:673)
at de.padlockblue.manager.masterinput$ResumableSub_Activity_Create.resume(masterinput.java:624)
at de.padlockblue.manager.masterinput._activity_create(masterinput.java:416)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at de.padlockblue.manager.masterinput.afterFirstLayout(masterinput.java:110)
at de.padlockblue.manager.masterinput.access$000(masterinput.java:22)
at de.padlockblue.manager.masterinput$WaitForLayout.run(masterinput.java:88)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7830)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.ads.InterstitialAd
... 20 more


Also based on the dexer issue, I guess.

Oh man, whats going up here?!

Regards
ARTsoft
 
Last edited:
Upvote 0

artsoft

Active Member
Licensed User
Longtime User
It works!

This was my mistake: I thought this lib would be FirebaseAdMob2:

2021-04-13 15_23_20-PADLOCKblue - B4A.png


But, you are right:
The real FirebaseAdmob2 jar file and its XML file were still missing.

You saved again the world for me, Erel.
Simply I only can say: Thank you!

Best regards
ARTsoft
 
Upvote 0
Top