Android Question [Solved] Error in 'Interstitial' ad button in b4xpages-admob-example

AnandGupta

Expert
Licensed User
Longtime User
Finally got time to install B4A 12.20.
Checked the admob sample,

Got error when 'Interstitial' ad button is touched and message box is closed with OK, as given below.
All other options are working OK. How to fix the Interstitial error ?

B4X:
B4A Version: 12.20
Parsing code.    (0.10s)
    Java Version: 8
Building folders structure.    (0.09s)
Compiling code.    (0.27s)
Compiling layouts code.    (0.01s)
Compiling debugger engine code.    (0.16s)
Running previous successful shell app.    (1.71s)
    Tip: Choose Tools - Clean project if you want to connect to a different device.
Completed successfully.

B4X:
Logger connected to: 2360e066
--------- beginning of crash
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.~i:** Activity (main) Resume **
ShowOpenAdIfAvailable: false~l374456463:onConsentInfoUpdateFailure: Publisher misconfiguration: Failed to read publisher's account configuration; please check your configured app ID. Received app ID: `ca-app-pub-3940256099942544~3347511713`., code: 3~l47655381:Consent: UNKNOWN
mwadi2 ReceiveAd~l671441793:Adview received
mwadi ReceiveAd
OpenAd received
Error occurred on line: 30 (Utils)
java.lang.NoSuchFieldException: right_left1
    at java.lang.Class.getDeclaredField(Class.java:886)
    at anywheresoftware.b4a.agraham.reflection.Reflection.GetStaticField(Reflection.java:371)
    at admob.tests.utils._setanimation(utils.java:139)
    at admob.tests.b4xmainpage$ResumableSub_pnlInterstitial_Click.resume(b4xmainpage.java:526)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    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 java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:150)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4a.keywords.Common$1.onClick(Common.java:490)
    at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:160)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5235)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
** Activity (main) Pause event (activity is not paused). **
 

AnandGupta

Expert
Licensed User
Longtime User
Solved it by commenting out the animation of activity codes.
Since this is B4XPages sample so I do not require animation between activities.

B4X:
'    In = r.GetStaticField(package & ".R$anim", InAnimation)
'    out = r.GetStaticField(package & ".R$anim", OutAnimation)
'    r.Target = r.GetActivity
'    r.RunMethod4("overridePendingTransition", Array As Object(In, out), Array As String("java.lang.int", "java.lang.int"))
 
Upvote 0
Top