Hello,
My B4A aplications that uses AdMob library crashes when running on Android 4.1 and 4.2 devices. But runs OK in android 5 or Android 6.
I searched the forum and found some questions about this problem with other librarues, but not a conclusive answer.
The same I´ve found at StackOverflow. It seem like the problem is with these Android versions.
The problem happens with other libaries too, as seen in the forum.
Someone know a workaround for this?
I use B4A 5.8. The Android support library jar is the most recent.
The code crashes at the instruction adview.LoadAd. I tried to use the TRY / CATCH to at least trap the error, but I think it doesn't worked. Only when running in these Android versions.
Testing in the IDE the logs shows:
My B4A aplications that uses AdMob library crashes when running on Android 4.1 and 4.2 devices. But runs OK in android 5 or Android 6.
I searched the forum and found some questions about this problem with other librarues, but not a conclusive answer.
The same I´ve found at StackOverflow. It seem like the problem is with these Android versions.
The problem happens with other libaries too, as seen in the forum.
Someone know a workaround for this?
I use B4A 5.8. The Android support library jar is the most recent.
The code crashes at the instruction adview.LoadAd. I tried to use the TRY / CATCH to at least trap the error, but I think it doesn't worked. Only when running in these Android versions.
B4X:
adHeight=50dip
adview1.Initialize2("Ad", "ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxx",adview1.SIZE_SMART_BANNER)
Activity.AddView(adview1, 0,0,100%x,adHeight)
adview1.BringToFront
Try
adview1.LoadAd
Catch
ToastMessageShow("AdMob LoadAd Error. Android Version.",False)
End Try
Testing in the IDE the logs shows:
LogCat connected to: 4100920ed3aacf00
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 345)
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 br.demasi.owliver.main._activity_create(main.java:345)
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 br.demasi.owliver.main.afterFirstLayout(main.java:102)
at br.demasi.owliver.main.access$000(main.java:17)
at br.demasi.owliver.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4935)
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:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
main_activity_create (java line: 345)
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 br.demasi.owliver.main._activity_create(main.java:345)
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 br.demasi.owliver.main.afterFirstLayout(main.java:102)
at br.demasi.owliver.main.access$000(main.java:17)
at br.demasi.owliver.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4935)
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:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)