Android crashes [AdMob, Unity]

1,893 views
Skip to first unread message

Pali P

unread,
Aug 17, 2021, 6:15:51 AM8/17/21
to Google Mobile Ads SDK Developers

Experiencing instant crashes on my Android device in our Unity app after adding the Google Mobile Ads plugin and building either through Unity Cloud or locally, I've tried a clean empty project that doesn't even try to use the plugin, just having the package installed causes crashes.

Unity 2019.4.5f1
Samsung Galaxy S8+

The projects run fine in Unity Editor, and builds without any obvious errors, but whenever trying to open the apps on device, they crash instantly, sometimes giving a black screen for less than a second but never more than that.

I've tried with no appID and the test ad appID's, would this cause this type of crashing? Is a proper appID required?

I've tried installing just the Google Mobile Ads v6.0.2 plugin or just the Ad Placements package and I've tried installing both. When installing the plugins it prompts to update older APIs, I've tried updating and not updating. I've tried adding the test ad appID's to the Androidmanifest, but always the same result: an instant crash.

I'm a missing something simple here? Is there required steps to set this up that I've overlooked?

Is it possible this result is only happening on the Samsung Galaxy S8+?

Using "adb logcat -s Unity" Doesn't give any errors or messages at all.

This issue is holding up our development so any help would be greatly appreciated!

Mobile Ads SDK Forum Advisor

unread,
Aug 17, 2021, 1:25:30 PM8/17/21
to pa...@gandiva.net, google-adm...@googlegroups.com
Hi Pali,

Thank you for reaching out to us with your concern. We would first start by asking if you are able to send us a simple sample with your implementation so that we can look over this. The second part, is that if you are just using our sample test ids? This should not cause anything to crash, especially at app start. From what I have seen, most of it would appear at the moment to be due to something with Unity, or how the app is built. Also if you have any crash logs or anything that shows what could be happening, this would help us to resolve this quicker for you.

Regards,
Google Logo
William Pescherine
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2LnsAk:ref

Pali P

unread,
Aug 18, 2021, 12:53:43 AM8/18/21
to Google Mobile Ads SDK Developers

Thanks for your reply.

Firstly, is Google Play Services required to get Ad Placements to work?

I'm using a bare bones Unity project that I've added the 'GoogleMobileAds-Ad-Placements' package too.


I get the above prompt and select Go Ahead! (I've tried both options.)

I also get this prompt and select Enable, which runs the resolver. (Again I've tried both.)

To avoid build errors, I've checked Google AdMob Enabled, and entered the test appIDs:

Android: ca-app-pub-3940256099942544/5224354917
iOS: ca-app-pub-3940256099942544/1712485313

But despite doing what seems the bare minimum, and not even really accessing the plugins it crashes every time.


I've attached the project with an .apk in the /AndroidBuild folder. As well as some relevant looking error logs from asb logcat:

"08-18 16:22:59.004  3835  5853 W ActivityManager:   Force finishing activity com.DefaultCompany.GoogleMobAds/com.unity3d.player.UnityPlayerActivity
08-18 16:22:59.004  3301  3301 I AudioFlinger: setMixerOutConfig return default condition, mixer key 2002, thread key 202
08-18 16:22:59.004  3301  3301 W AudioPolicyIntefaceImpl: Skipped to add effects on session 521
08-18 16:22:59.004  3301  3301 V APM_AudioPolicyManager: startOutput() output 21, stream 1, session 521
08-18 16:22:59.004  3301  3301 V APM_AudioPolicyManager: setBeaconMute(1) mBeaconMuteRefCount=1 mBeaconPlayingRefCount=0
08-18 16:22:59.004  3301  3301 V APM_AudioPolicyManager: getNewOutputDevice() selected device 2
08-18 16:22:59.004  3301  3301 V APM_AudioPolicyManager: setOutputDevice() device 0002 delayMs 0
08-18 16:22:59.004  3301  3301 V APM_AudioPolicyManager: setOutputDevice() prevDevice 0x0002
08-18 16:22:59.004  3301  3301 V APM_AudioPolicyManager: setOutputDevice: suppressing checkDeviceMuteStrategies
08-18 16:22:59.005  3301  3301 V APM_AudioPolicyManager: setOutputDevice() setting same device 0x0002 or null device
08-18 16:22:59.005  3835  3835 D Telecom:SamsungPrebindingServiceImpl: onTopActivityChanged : ComponentInfo{com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity}
08-18 16:22:59.005 19741 19741 V SENL$WidgetToolBarProvider: onUpdate 0
08-18 16:22:59.006  3303  5710 E BufferQueueProducer: [Application Error: com.DefaultCompany.GoogleMobAds#0] disconnect: not connected (req=1)
08-18 16:22:59.006  3835  4107 W libEGL  : EGLNativeWindowType 0x71e9f33010 disconnect failed"

"08-18 16:22:58.298  3303  3303 I SurfaceFlinger:      Client | 0x7bbc051800 | 0000 | RGBA_8888 |   8.0    0.0  517.0 1267.0 |    0  413  511 1682 | Application Error: com.DefaultCompany.GoogleMobAds#0
08-18 16:22:58.298  3303  3303 I SurfaceFlinger:      Client | 0x7bbc050760 | 0000 | RGBA_8888 |   2.0    0.0 1080.0  124.0 |    0 2094 1080 2220 | NavigationBar[4159]#0"

"08-18 16:22:58.742 19724 19724 I MultiDex: VM with version 2.1.0 has multidex support
08-18 16:22:58.742 19724 19724 I MultiDex: Installing application
08-18 16:22:58.742 19724 19724 I MultiDex: VM has multidex support, MultiDex support library is disabled.
08-18 16:22:58.774  3835  4388 D PackageManager: setEnabledSetting : userId = 0 packageName = com.sec.android.app.samsungapps cmp = androidx.work.impl.background.systemjob.SystemJobService newState = 1 callingPackage = 10100/com.sec.android.app.samsungapps
08-18 16:22:58.811 19724 19724 D SamsungApps: GalaxyApps Application onCreate calling...
08-18 16:22:58.866 19724 19724 V ConcreteDeviceInfoLoader: SimState is not Ready
08-18 16:22:58.866 19724 19724 V ConcreteDeviceInfoLoader: deviceInfo MCC value is not correct
08-18 16:22:58.901 19741 19741 I FirebaseInitProvider: FirebaseApp initialization successful
08-18 16:22:58.916 19741 19741 D DIAGMON_SDK[605034]: setDeviceId :
08-18 16:22:58.925  3835  4110 D GameManagerService: handleForegroundChange(). pkgName: com.DefaultCompany.GoogleMobAds, clsName: com.unity3d.player.UnityPlayerActivity,FgActivityName:com.DefaultCompany.GoogleMobAds/com.unity3d.player.UnityPlayerActivity,userID:0
08-18 16:22:58.925  3835  4110 D GameManagerService:   handleForegroundChange(). same package. game has never resumed yet. ignore"

"08-18 16:22:59.019  3835  3860 V WindowManager: Remove Window{9849cad u0 Application Error: com.DefaultCompany.GoogleMobAds}: mSurfaceController=Surface(name=Application Error: com.DefaultCompany.GoogleMobAds)/@0x57a3c19 mAnimatingExit=false mRemoveOnExit=false mHasSurface=true surfaceShowing=true isAnimationSet=false app-animation=false mWillReplaceWindow=false inPendingTransaction=false mDisplayFrozen=false callers=com.android.server.wm.WindowState.removeIfPossible:2751 com.android.server.wm.WindowManagerService.removeWindow:1980 com.android.server.wm.Session.remove:268 android.view.ViewRootImpl.dispatchDetachedFromWindow:4546 android.view.ViewRootImpl.doDie:7976 android.view.ViewRootImpl.die:7944"

"08-18 16:22:59.020  3835  3860 I WindowManager: Cancelling animation restarting=true, leash=null, surface=Surface(name=9849cad Application Error: com.DefaultCompany.GoogleMobAds)/@0x2c8018c, parent=Surface(name=WindowToken{930d056 android.view.ViewRootImpl$W@e1eca71})/@0xde980d5
08-18 16:22:59.020  3835  3860 I WindowManager: Reparenting to leash, surface=Surface(name=9849cad Application Error: com.DefaultCompany.GoogleMobAds)/@0x2c8018c
08-18 16:22:59.021  3303  3303 I SurfaceFlinger: id=1342 createSurf (5920x5920),2 flag=4, Surface(name=9849cad Application Error: com.DefaultCompany.GoogleMobAds)/@0x2c8018c - animation-leash#0
08-18 16:22:59.022  3835  3860 D SurfaceControl: reparent is called, sc=Surface(name=9849cad Application Error: com.DefaultCompany.GoogleMobAds)/@0x2c8018c, newParentHandle=android.os.BinderProxy@5ac3668, transaction=android.view.SurfaceControl$Transaction@ec0fdb
08-18 16:22:59.025  3835  3860 V WindowManager: Changing focus from Window{9849cad u0 Application Error: com.DefaultCompany.GoogleMobAds EXITING} to null Callers=com.android.server.wm.WindowState.setupWindowForRemoveOnExit:2901 com.android.server.wm.WindowState.removeIfPossible:2872 com.android.server.wm.WindowState.removeIfPossible:2751 com.android.server.wm.WindowManagerService.removeWindow:1980"

"08-18 16:22:59.049  3835  5853 E ActivityManager: Found activity ActivityRecord{9b465 u0 com.DefaultCompany.GoogleMobAds/com.unity3d.player.UnityPlayerActivity t-1 f} in proc activity list using null instead of expected ProcessRecord{67d5fb2d0 19591:com.DefaultCompany.GoogleMobAds/u0a251}"

"08-18 16:23:03.489  3835  5854 I ActivityManager: Killing 19817:com.DefaultCompany.GoogleMobAds/u0a251 (adj 199): crash
08-18 16:23:03.491  3835  3862 W libprocessgroup: kill(-19817, 9) failed: No such process
08-18 16:23:03.492  3835  3835 D MdnieScenarioControlService: MultiWindowState : false
08-18 16:23:03.492  3835  3835 D GameManagerService: MultiWindowEventListener.onFocusStackChanged(), state=0, top=ComponentInfo{com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity}
08-18 16:23:03.492  3835  5848 D GamePkgDataHelper: getSosPolicy(). com.sec.android.app.launcher"

"08-18 16:23:00.392  5804  5831 I PageOverlayServiceImpl: [FROM HOME] updateActivityLifecycleState : 3
08-18 16:23:00.392  3835  5854 W ActivityManager: crash : com.DefaultCompany.GoogleMobAds,0
08-18 16:23:00.392  5255  5255 D HotwordClientUtils: setHotWordDetection : call requestHotWordDetection false
08-18 16:23:00.394  3835  3931 D ViewRootImpl@5619740[GoogleMobAds]: setView = DecorView@89d39e6[GoogleMobAds] TM=true MM=false
08-18 16:23:00.397  3835  3931 D ViewRootImpl@5619740[GoogleMobAds]: dispatchAttachedToWindow
08-18 16:23:00.398 16739 16786 I MicroDetectionState: Should stop hotword detection immediately - true
08-18 16:23:00.402 19053 19053 I BatteryReceiver: Received : com.samsung.android.sm.ACTION_ERROR
08-18 16:23:00.402 19053 19053 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1610 android.content.ContextWrapper.startService:677 com.samsung.android.sm.battery.receiver.BatteryReceiver.e:186 com.samsung.android.sm.battery.receiver.BatteryReceiver.onReceive:66 android.app.ActivityThread.handleReceiver:3603"

I also found this thread:


And following some of the advice I was able to get the build to running by excluding the External Resolver files, but although it runs, I got the following error:

"java.lang.ClassNotFoundException: com.google.android.gms.ads.initialization.OnInitializationCompleteListener"

As obviously some dependencies are missing.

Note: Originally I was trying to get our main project working and was using cloud build.

Thanks for your help.

Pali P

unread,
Aug 18, 2021, 1:09:51 AM8/18/21
to Google Mobile Ads SDK Developers
Images that didn't stay in message.
EnableResolver.PNG
Api.png

Mobile Ads SDK Forum Advisor

unread,
Aug 18, 2021, 6:40:57 AM8/18/21
to pa...@gandiva.net, google-adm...@googlegroups.com
Hi Pali,

Thank you for providing an extensive details of your concern. However,  it's hard for us to debug further as we don't have a full visibility of your implementation. We would need a project (or at least a sample project) in order to actually make any progress in diagnosing this. With that all said, could you please provide a project or at least a test project (via Reply to author option. If the option does not work, kindly reply to mobileadstesting99@gmail.com, then let us know here once sent) so that we can further investigate this issue.

Regards,
Google Logo
Teejay Wennie Pimentel
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2LnsAk:ref

Pali P

unread,
Aug 19, 2021, 2:40:36 AM8/19/21
to Google Mobile Ads SDK Developers

So I believe my test project was setup incorrectly anyway, and going back to my real project I discovered this error:

08-19 18:22:52.366 19147 19147 E AndroidRuntime: FATAL EXCEPTION: main
08-19 18:22:52.366 19147 19147 E AndroidRuntime: Process: com.***.***, PID: 19147
08-19 18:22:52.366 19147 19147 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
08-19 18:22:52.366 19147 19147 E AndroidRuntime:
08-19 18:22:52.366 19147 19147 E AndroidRuntime: ******************************************************************************
08-19 18:22:52.366 19147 19147 E AndroidRuntime: * Invalid application ID. Follow instructions here:                          *
08-19 18:22:52.366 19147 19147 E AndroidRuntime: * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
08-19 18:22:52.366 19147 19147 E AndroidRuntime: * to find your app ID.                                                       *
08-19 18:22:52.366 19147 19147 E AndroidRuntime: ******************************************************************************
08-19 18:22:52.366 19147 19147 E AndroidRuntime:
08-19 18:22:52.366 19147 19147 E AndroidRuntime:
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.app.ActivityThread.installProvider(ActivityThread.java:6747)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6289)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6204)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.app.ActivityThread.access$1200(ActivityThread.java:237)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1785)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:214)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7050)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
08-19 18:22:52.366 19147 19147 E AndroidRuntime: Caused by: java.lang.IllegalStateException:
08-19 18:22:52.366 19147 19147 E AndroidRuntime:
08-19 18:22:52.366 19147 19147 E AndroidRuntime: ******************************************************************************
08-19 18:22:52.366 19147 19147 E AndroidRuntime: * Invalid application ID. Follow instructions here:                          *
08-19 18:22:52.366 19147 19147 E AndroidRuntime: * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
08-19 18:22:52.366 19147 19147 E AndroidRuntime: * to find your app ID.                                                       *
08-19 18:22:52.366 19147 19147 E AndroidRuntime: ******************************************************************************
08-19 18:22:52.366 19147 19147 E AndroidRuntime:
08-19 18:22:52.366 19147 19147 E AndroidRuntime:
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at com.google.android.gms.internal.ads.zzzj.attachInfo(com.google.android.gms:play-services-ads-lite@@19.5.0:24)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.5.0:3)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        at android.app.ActivityThread.installProvider(ActivityThread.java:6742)
08-19 18:22:52.366 19147 19147 E AndroidRuntime:        ... 10 more

Does this explain the crashing?

On Wednesday, August 18, 2021 at 10:40:57 PM UTC+12 mobileadssdk wrote:
Hi Pali,

Thank you for providing an extensive details of your concern. However,  it's hard for us to debug further as we don't have a full visibility of your implementation. We would need a project (or at least a sample project) in order to actually make any progress in diagnosing this. With that all said, could you please provide a project or at least a test project (via Reply to author option. If the option does not work, kindly reply to mobileads...@gmail.com, then let us know here once sent) so that we can further investigate this issue.

Mobile Ads SDK Forum Advisor

unread,
Aug 19, 2021, 5:52:52 AM8/19/21
to pa...@gandiva.net, google-adm...@googlegroups.com

Hello Pali,

Thank you for reaching out to us.

I work with Teejay and will be assisting you on this. It looks like there is an error on your setup under the app id as it is mentioned on the logs. You can follow this guide to configure your app and update your manifest.

Regards,

Google Logo
Princess Pamela Pineda
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2LnsAk:ref
Reply all
Reply to author
Forward
0 new messages