Android Question Admob crash

samannnn

Member
i use firebaseAdmob version 1.60.

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="28"/>

i have problem in admob when API is 4.0.3 and 4.0.4 and i know that admob support minSdkVersion is 16 or later.
i use:

B4X:
If phon.SdkVersion>15 Then
        AdView1.Initialize2("AdBanner", "ca-app-pub-72...", AdView1.SIZE_BANNER)
        Dim AdMobHeight As Int
        Dim ScreenHeightScaled As Float
        ScreenHeightScaled = GetDeviceLayoutValues.Height / GetDeviceLayoutValues.Scale
        If ScreenHeightScaled <= 400 Then
            AdMobHeight = 32dip
        Else if ScreenHeightScaled > 400 And ScreenHeightScaled <= 720 Then
            AdMobHeight = 50dip
        Else if ScreenHeightScaled > 720 Then
            AdMobHeight = 90dip
        End If
        Activity.AddView(AdView1, 6%x,92%y,320dip,AdMobHeight)
        AdView1.LoadAd

        IAd.Initialize("iad", "ca-app-pub-7244......") ' full Screen admob
        IAd.LoadAd
    
    End If

but i have Firebase crashlytics error :

B4X:
Fatal Exception: java.lang.NullPointerException
       at com.google.android.gms.internal.ads.zzbem.destroy(com.google.android.gms:play-services-ads@@19.0.1:471)
       at android.webkit.WebView$8.run(WebView.java:4894)
       at android.os.Handler.handleCallback(Handler.java:605)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4514)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
       at dalvik.system.NativeStart.main(NativeStart.java)

I think this happens when the program wants to run.
How to prevent it?
any suggestion or help?
thank you.
 
Top