Android Question Admob Crash Interstitial and Banner

Douglas Farias

Expert
Licensed User
Longtime User
Hi all.
i m related on google play console some crash on the apps.
The cause its the admob.

On my devices i have no problem, on google play i see android 4.1 to 4.4

1.png


2.png


My google play Services on SDK Manager its REV 29 (the last i think).
On my devices android 5.0+ are normal, no errors.

I m make a test with android ADV and android 4.2.2.
On the emulator i see the error.

The crash its with admob banner and interstitial too.

Here the log with interstitial only.
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 120)
mwAdInterstitial.LoadAd
java.lang.NoClassDefFoundError: android.support.v4.util.SimpleArrayMap
at com.google.android.gms.ads.internal.zzs.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzs.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzb.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzc.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzk.<init>(Unknown Source)
at com.google.android.gms.ads.internal.ClientApi.createInterstitialAdManager(Unknown Source)
at com.google.android.gms.ads.internal.client.zzl.createInterstitialAdManager(Unknown Source)
at com.google.android.gms.ads.internal.client.zze.zzb(Unknown Source)
at com.google.android.gms.ads.internal.client.zzac.zzH(Unknown Source)
at com.google.android.gms.ads.internal.client.zzac.zza(Unknown Source)
at com.google.android.gms.ads.InterstitialAd.loadAd(Unknown Source)
at mobi.mindware.admob.interstitial.AdmobInterstitialsAds.LoadAd(AdmobInterstitialsAds.java:91)
at leitor.df.texto.main._activity_create(main.java:449)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at leitor.df.texto.main.afterFirstLayout(main.java:102)
at leitor.df.texto.main.access$000(main.java:17)
at leitor.df.texto.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)

Code used
B4X:
       mwAdInterstitial.Initialize("mwadi","ca-app-pub-xxxxxxxxxxxxxxxxxx")
        mwAdInterstitial.LoadAd
Crash on mwAdInterstitial.LoadAd

and here the admob banner

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 135)
Adview1.LoadAd
java.lang.NoClassDefFoundError: android.support.v4.util.SimpleArrayMap
at com.google.android.gms.ads.internal.zzs.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzs.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzb.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzc.<init>(Unknown Source)
at com.google.android.gms.ads.internal.zzf.<init>(Unknown Source)
at com.google.android.gms.ads.internal.ClientApi.createBannerAdManager(Unknown Source)
at com.google.android.gms.ads.internal.client.zzl.createBannerAdManager(Unknown Source)
at com.google.android.gms.ads.internal.client.zze.zza(Unknown Source)
at com.google.android.gms.ads.internal.client.zzab.zzdh(Unknown Source)
at com.google.android.gms.ads.internal.client.zzab.zzdg(Unknown Source)
at com.google.android.gms.ads.internal.client.zzab.zza(Unknown Source)
at com.google.android.gms.ads.BaseAdView.loadAd(Unknown Source)
at com.google.android.gms.ads.AdView.loadAd(Unknown Source)
at anywheresoftware.b4a.admobwrapper.AdViewWrapper.LoadAd(AdViewWrapper.java:118)
at leitor.df.texto.main._activity_create(main.java:472)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at leitor.df.texto.main.afterFirstLayout(main.java:102)
at leitor.df.texto.main.access$000(main.java:17)
at leitor.df.texto.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)

Code used
B4X:
        Adview1.Initialize2("Ad", "ca-app-pub-xxxxxxxxxxxxxxxx", Adview1.SIZE_SMART_BANNER)
        Dim height As Int
        If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
        If 100%x > 100%y Then height = 32dip Else height = 50dip 'SMARTPHONES
        Else
        height = 90dip 'TABLETS
        End If
        Activity.AddView(Adview1, 0dip, 100%y - height, 100%x, height)
        Adview1.Color = Colors.White
        Adview1.LoadAd


how can i fix this errors?
Note: Try and Catch its ignored by this errors, banner and interstitial.
no way to make this works on android 4+

thx all
 

Douglas Farias

Expert
Licensed User
Longtime User
Fixed, copied the the lib android-support-v4.jar from C:\Android\extras\android\support\v4 to my internal libs folder.
i m already have this android-support-v4.jar but replaced and works now o_Oo_O
 
Upvote 0

CyclopDroid

Well-Known Member
Licensed User
Longtime User
Hi Dooglas Farias.
I've the some proble in my old game.
I want modify it, but i received your identical message of error.
I accidentally did the opposite, reversing copy folders.
Where can I get the old version of the V4? I downloaded a version and copied in both folders, but it keeps giving me seprate the same mistake.
Thank you.
PS: My versiom or google play services, now, is v37
 
Upvote 0
Top