Android Question FirebaseAdmob2 Crashing sometimes

FrostCodes

Active Member
Licensed User
Longtime User
Hi everyone!
I noticed this error message when I tried to reload a new ad after a user just viewed one, please how can i solve it? Please note that the AdUnitId is set and the initial ad shows. This error just happens once in a while.


B4X:
Sub InterstitialAd1_AdClosed
    InterstitialAd1.LoadAd 
End Sub


ERROR:


B4X:
Error occurred on line: 402 (QuestionsAndComments)
java.lang.NullPointerException: AdUnitId cannot be null.
    at com.google.android.gms.common.internal.Preconditions.checkNotNull(com.google.android.gms:play-services-basement@@18.1.0:2)
    at com.google.android.gms.ads.interstitial.InterstitialAd.load(com.google.android.gms:play-services-ads-lite@@21.3.0:2)
    at anywheresoftware.b4a.admobwrapper.AdViewWrapper$InterstitialAdWrapper.LoadAdWithBuilder(AdViewWrapper.java:198)
    at anywheresoftware.b4a.admobwrapper.AdViewWrapper$InterstitialAdWrapper.LoadAd(AdViewWrapper.java:191)
    at com.xx.xx.xx._interstitialad1_adclosed(questionsandcomments.java:1479)
    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:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
    at anywheresoftware.b4a.BA$2.run(BA.java:387)
    at anywheresoftware.b4a.BA.setActivityPaused(BA.java:459)
    at com.xx.xx.questionsandcomments.afterFirstLayout(questionsandcomments.java:112)
    at com.xx.xx.questionsandcomments.access$000(questionsandcomments.java:20)
    at com.xx.xx.questionsandcomments$WaitForLayout.run(questionsandcomments.java:86)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
 

FrostCodes

Active Member
Licensed User
Longtime User
Yes I updated everything recently
1672122129982.png
 
Upvote 0

FrostCodes

Active Member
Licensed User
Longtime User
Hi @Erel thanks I thought so also but I called the loadAD after an interstitial was just closed which means my ads Id was available and the interstitial was initialized properly.

It might be a little hard to spot because doesn't happen always just once in a while and my AD UNIT Id was hard coded so if it was a variable I would have thought that might have something to do with the cause.
 
Upvote 0
Top