Hello,
I have an app with Admob plugin and working fine on device when builded with Corona 2018.3326, but when I try to build with 2019.3540 and run on device it crashes immediately.
From adb logcat the problem seems Admob:
/dalvikvm( 4962): Could not find method android.content.pm.PackageManager.isInstantApp, referenced from method com.google.android.gms.common.wrappers.PackageManagerWrapper.isCallerInstantApp W/dalvikvm( 4962): VFY: unable to resolve virtual method 979: Landroid/content/pm/PackageManager;.isInstantApp (Ljava/lang/String;)Z D/dalvikvm( 4962): VFY: replacing opcode 0x6e at 0x002d D/AndroidRuntime( 4962): Shutting down VM W/dalvikvm( 4962): threadid=1: thread exiting with uncaught exception (group=0x416bebc0) E/AndroidRuntime( 4962): FATAL EXCEPTION: main E/AndroidRuntime( 4962): Process: com.sanga.admobapp, PID: 4962 E/AndroidRuntime( 4962): java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: E/AndroidRuntime( 4962): E/AndroidRuntime( 4962): \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* E/AndroidRuntime( 4962): \* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers \* E/AndroidRuntime( 4962): \* should follow the instructions here: https://goo.gl/fQ2neu to add a valid \* E/AndroidRuntime( 4962): \* App ID inside the AndroidManifest. Google Ad Manager publishers should \* E/AndroidRuntime( 4962): \* follow instructions here: https://goo.gl/h17b6x. \* E/AndroidRuntime( 4962): \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* E/AndroidRuntime( 4962): E/AndroidRuntime( 4962): E/AndroidRuntime( 4962): at android.app.ActivityThread.installProvider(ActivityThread.java:5196) E/AndroidRuntime( 4962): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4788) E/AndroidRuntime( 4962): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4728) E/AndroidRuntime( 4962): at android.app.ActivityThread.access$1500(ActivityThread.java:166) E/AndroidRuntime( 4962): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343) E/AndroidRuntime( 4962): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime( 4962): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime( 4962): at android.app.ActivityThread.main(ActivityThread.java:5584) E/AndroidRuntime( 4962): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 4962): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime( 4962): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) E/AndroidRuntime( 4962): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) E/AndroidRuntime( 4962): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 4962): Caused by: java.lang.IllegalStateException: E/AndroidRuntime( 4962): E/AndroidRuntime( 4962): \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* E/AndroidRuntime( 4962): \* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers \* E/AndroidRuntime( 4962): \* should follow the instructions here: https://goo.gl/fQ2neu to add a valid \* E/AndroidRuntime( 4962): \* App ID inside the AndroidManifest. Google Ad Manager publishers should \* E/AndroidRuntime( 4962): \* follow instructions here: https://goo.gl/h17b6x. \* E/AndroidRuntime( 4962): \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* E/AndroidRuntime( 4962): E/AndroidRuntime( 4962): E/AndroidRuntime( 4962): at com.google.android.gms.internal.ads.zzabh.attachInfo(Unknown Source) E/AndroidRuntime( 4962): at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(Unknown Source) E/AndroidRuntime( 4962): at android.app.ActivityThread.installProvider(ActivityThread.java:5193) E/AndroidRuntime( 4962): ... 12 more
I already added the Admob app_id into build.settings
settings = { android = { applicationChildElements = { [[\<meta-data android:name="com.google.android.gms.ads.APPLICATION\_ID" android:value="ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY"/\>]], } }, plugins = { ["plugin.admob"] = { publisherId = "com.coronalabs" }, } }
I think could not be the Admob init code because it’s not into main.lua, and the app crash before Corona splash screen.
main.lua load settings -> show custom splash.lua -> show game.lua where Admob init code called.
local function adListener( event ) -- Successful initialization of AdMob if ( event.phase == "init" ) then native.setActivityIndicator( true ) admob.load( "banner", { adUnitId=\_G.bannerID} ) admob.load( "interstitial", { adUnitId=\_G.interstitialID} ) admob.load( "rewardedVideo", { adUnitId=\_G.rewardedVideoID} ) elseif ( event.phase == "loaded" ) then if admob.isLoaded( "banner" ) and admob.isLoaded( "interstitial" ) then native.setActivityIndicator( false ) end if tostring(event.type) == "banner" then admob.show( "banner" ) end elseif ( event.phase == "closed" ) then if tostring(event.type) == "interstitial" then native.setActivityIndicator( true ) admob.load( "interstitial", { adUnitId=\_G.interstitialID} ) elseif tostring(event.type) == "rewardedVideo" then --native.setActivityIndicator( true ) admob.load( "rewardedVideo", { adUnitId=\_G.rewardedVideoID} ) end elseif ( event.phase == "displayed" ) then if tostring(event.type) == "rewardedVideo" then native.setActivityIndicator( false ) end elseif ( event.phase == "reward" ) then --reward -- The ad failed to load elseif ( event.phase == "failed" ) then native.setActivityIndicator( false ) end end admob.init( adListener, { appId=\_G.appID, testMode=false } )
Thanks to anyone who has suggestions for understanding the problem.
Federico