coronalabs / corona

Solar2D Game Engine main repository (ex Corona SDK)
https://solar2d.com/
MIT License
2.52k stars 272 forks source link

AdMob Plugin issue #176

Closed vegasfun closed 4 years ago

vegasfun commented 4 years ago

Getting a strange AdMob related error in Google Play PreLaunch Reports that doesn't appear to cause a crash but is reported as one by Google Play. Google AdMob crash logcat 2.txt

Issue: java.lang.RuntimeException: Unable to destroy activity {com.gmail.vegasfungames.vegasfun/com.ansca.corona.CoronaActivity}: java.lang.NullPointerException: Attempt to write to field 'com.google.android.gms.ads.reward.RewardedVideoAd plugin.admob.LuaLoader$CoronaAdmobRewardedDelegate.rewardedAd' on a null object reference

NOTES: Logcat attached Fortunately there is a full log of everything and an identical "crash" is being reported on some actual devices. It runs fine for us on 2 test devices. I even clicked and quickly closed a Reward video (hopefully the Google ad police won't get mad). Test ads ok Strange thing is the "crash" doesn't happen when running the AdMob demo account/ads. It looks the "crash" is only happening when Google tries to exit the app. Another app works fine with virtually identical code We have another similar app with identical AdMob code, etc. that doesn't seem to have this issue

Shchvova commented 4 years ago

Crash in crash log is in "OnExiting" handler. Does it seems like something reasonable?

Shchvova commented 4 years ago

Anyway. Here it is:

10-11 22:55:26.444: E/MonitoringInstr(18487): Exception encountered by: com.ansca.corona.CoronaActivity@832c192. Dumping thread state to outputs and pining for the fjords.
10-11 22:55:26.444: E/MonitoringInstr(18487): java.lang.NullPointerException: Attempt to write to field 'com.google.android.gms.ads.reward.RewardedVideoAd plugin.admob.LuaLoader$CoronaAdmobRewardedDelegate.rewardedAd' on a null object reference
10-11 22:55:26.444: E/MonitoringInstr(18487):   at plugin.admob.LuaLoader$3.run(LuaLoader.java:350)
10-11 22:55:26.444: E/MonitoringInstr(18487):   at android.app.Activity.runOnUiThread(Activity.java:6283)
10-11 22:55:26.444: E/MonitoringInstr(18487):   at plugin.admob.LuaLoader.onExiting(LuaLoader.java:329)
10-11 22:55:26.444: E/MonitoringInstr(18487):   at com.ansca.corona.CoronaEnvironment$RuntimeEventHandler.onExiting(CoronaEnvironment.java:549)
10-11 22:55:26.444: E/MonitoringInstr(18487):   at com.ansca.corona.CoronaRuntime.onExiting(CoronaRuntime.java:479)

This should be fixed with coronalabs/com.coronalabs-plugin.admob@3c8a9368cacbaa08b99f3e6a04ccda83f4f2d443

Fixed Android plugin is already live