SecurityException: Package android does not belong to Uid

3,696 views
Skip to first unread message

itzno...@gmail.com

unread,
Jun 20, 2022, 1:29:16 AM6/20/22
to Google Mobile Ads SDK Developers
A few devices on Android 11 are getting this crash, in my case, it is a Motorola device.
The issue is a platform crash has been fixed on Android S & above as per: https://issuetracker.google.com/issues/175055271

However, this crash happens at the very start of the App where AdMob SDK is probably performing network-based ops like `registerDefaultNetworkCallback`.

Details - 
Note: All data as per Crashlytics

Android version: Android 11
Device Build: Motorola (moto g(20))
Locally reproducible: No (so, no sample app)
SecurityException Stacktrace: 
Fatal Exception: java.lang.SecurityException: Package android does not belong to 10262
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
       at android.os.Parcel.createException(Parcel.java:2357)
       at android.os.Parcel.readException(Parcel.java:2340)
       at android.os.Parcel.readException(Parcel.java:2282)
       at android.net.IConnectivityManager$Stub$Proxy.requestNetwork(IConnectivityManager.java:3503)
       at android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:3688)
       at android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4191)
       at android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4158)
       at com.google.android.gms.ads.internal.state.h.e(h.java:9)
       at com.google.android.gms.ads.nonagon.a.q(a.java:11)
       at com.google.android.gms.ads.nonagon.a.a(a.java)
       at com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl.getMobileAdsSettingManager(ChimeraMobileAdsSettingManagerCreatorImpl.java:4)
       at com.google.android.gms.ads.internal.client.bv.bO(bv.java:5)
       at adu.onTransact(adu.java:4)
       at android.os.Binder.transact(Binder.java:1043)
       at eoc.gr(eoc.java:2)
       at com.google.android.gms.ads.internal.client.ay.getMobileAdsSettingManager(ay.java)
       at com.google.android.gms.ads.MobileAdsSettingManagerCreatorImpl.getMobileAdsSettingManager(MobileAdsSettingManagerCreatorImpl.java:5)
       at com.google.android.gms.ads.internal.client.az.ej(az.java:3)
       at eod.onTransact(eod.java:12)
       at android.os.Binder.transact(Binder.java:1043)
       at com.google.android.gms.internal.ads.zzaqv.zzbk(com.google.android.gms:play-services-ads-base@@21.0.0:2)
       at com.google.android.gms.ads.internal.client.zzcn.zze(com.google.android.gms:play-services-ads-lite@@21.0.0:4)
       at com.google.android.gms.ads.internal.client.zzel.zza(com.google.android.gms:play-services-ads-lite@@21.0.0:3)
       at com.google.android.gms.ads.internal.client.zzao.zzc(com.google.android.gms:play-services-ads-lite@@21.0.0:12)
       at com.google.android.gms.ads.internal.client.zzav.zzf(com.google.android.gms:play-services-ads-lite@@21.0.0:1)
       at com.google.android.gms.ads.internal.client.zzav.zzd(com.google.android.gms:play-services-ads-lite@@21.0.0:11)
       at com.google.android.gms.ads.internal.client.zzee.zzy(com.google.android.gms:play-services-ads-lite@@21.0.0:3)
       at com.google.android.gms.ads.internal.client.zzee.zzl(com.google.android.gms:play-services-ads-lite@@21.0.0:7)
       at com.google.android.gms.ads.MobileAds.initialize(com.google.android.gms:play-services-ads-lite@@21.0.0:3)
       at com.app.BaseApp.initAds(BaseApp.kt:52)
       at com.app.BaseApp.onCreate(BaseApp.kt:36)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6955)
       at android.app.ActivityThread.access$1300(ActivityThread.java:263)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1991)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:240)
       at android.app.ActivityThread.main(ActivityThread.java:8000)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
--------------------------------------------------------------------------------------------------------------------------------------------

RemoteException Stacktrace:
Caused by android.os.RemoteException: Remote stack trace:
    at android.app.AppOpsManager.checkPackage(AppOpsManager.java:7864)
    at com.android.server.ConnectivityService.ensureSufficientPermissionsForRequest(ConnectivityService.java:5539)
    at com.android.server.ConnectivityService.requestNetwork(ConnectivityService.java:5634)
    at android.net.IConnectivityManager$Stub.onTransact(IConnectivityManager.java:1570)
    at android.os.Binder.execTransactInternal(Binder.java:1154)
--------------------------------------------------------------------------------------------------------------------------------------------

I know there might be very little to do as this is a platform issue, however, is there anything that can be done to avoid a crash like this at the start of the app because Ads SDK needs to be initialized as soon as possible?

Thanks.


Mobile Ads SDK Forum Advisor

unread,
Jun 21, 2022, 6:01:29 AM6/21/22
to itzno...@gmail.com, google-adm...@googlegroups.com

Hi Darshan,

Thank you for reaching out to us.

Before we share this to the rest of the team, can we request the additional information below?

  • SDK version
  • Mediation adapter used

Regards,

Google Logo
Princess Pamela
Mobile Ads SDK Team
 

 

ref:_00D1U1174p._5004Q2by6zw:ref

itzno...@gmail.com

unread,
Jun 21, 2022, 6:03:18 AM6/21/22
to Google Mobile Ads SDK Developers
AdMob SDK: 21.0.0
Mediation Adapters: AdColony & AppLovin [both latest versions]

Thanks.

Mobile Ads SDK Forum Advisor

unread,
Jun 21, 2022, 10:20:39 AM6/21/22
to itzno...@gmail.com, google-adm...@googlegroups.com

Hi Darshan,

Thank you for providing the requested details.

Let me share this to the rest of the team to further investigate this. We will update you once we have more information.

itzno...@gmail.com

unread,
Jun 26, 2022, 2:13:11 AM6/26/22
to Google Mobile Ads SDK Developers
A vital piece of information that I've found while checking Crashlytics is that most of these crashes (around 98%) are caused while the App was in the background.
We initialize the Ads SDK in our Application.onCreate() which can be invoked by the system even when the app is in the background via a Broadcast or WorkManager, etc.

I'll try to handle that scenario & report back if it makes any difference.

Mobile Ads SDK Forum Advisor

unread,
Jun 27, 2022, 4:40:42 AM6/27/22
to itzno...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for sharing this to us. I've shared this also to the rest of the team as additional information. We will update you once we have more information.

itzno...@gmail.com

unread,
Jul 8, 2022, 2:52:27 AM7/8/22
to Google Mobile Ads SDK Developers
I can confirm that this happens when the app is in background, probably woken up by WorkManager or a reboot Broadcast receiver & MobileAds.initialize(context) is called via android.app.Application.onCreate().

itzno...@gmail.com

unread,
Aug 10, 2022, 4:16:47 AM8/10/22
to Google Mobile Ads SDK Developers
Any updates on this?

Mobile Ads SDK Forum Advisor

unread,
Aug 10, 2022, 5:13:13 AM8/10/22
to itzno...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for patiently waiting.

Upon checking, the team is still investigating this. I've followed this to them for any updates. We will update you as soon as we gather more information.

itzno...@gmail.com

unread,
Aug 29, 2022, 8:20:08 AM8/29/22
to Google Mobile Ads SDK Developers
Hi Team,
Any updates on this crash?

Mobile Ads SDK Forum Advisor

unread,
Aug 30, 2022, 1:37:15 AM8/30/22
to itzno...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for patiently waiting.

The team is still investigating this. I've followed this again to them for any updates. We will update you as soon as we gather more information. We humbly ask for your patience here in the meantime.

Mobile Ads SDK Forum Advisor

unread,
Sep 2, 2022, 3:06:11 AM9/2/22
to itzno...@gmail.com, google-adm...@googlegroups.com

Hi,

I hope you're doing well.

I just want to circle back on this. The team mentioned that if the crashes is mostly Android 11, it should be an Android framework bug that GMA can't solve. The bug has been fixed in 12. Updating to Android 12 could help solve the problem. Feel free to come back to us if you still encounter any issues regarding this.

Message has been deleted

Mobile Ads SDK Forum Advisor

unread,
Sep 2, 2022, 9:38:46 AM9/2/22
to itzno...@gmail.com, google-adm...@googlegroups.com

Hi,

Thanks for letting us know, and feel free to reach out to us for any other Mobile Ads SDK concern by opening a new forum thread. We will be happy to assist you.

Thank you.

Regards,

Google Logo
Yasar
Mobile Ads SDK Team
 


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