google / play-services-plugins

Plugins to help with using Google Play services SDK.
https://developers.google.com/android/guides/overview
Apache License 2.0
471 stars 137 forks source link

Obfuscation of OssLicensesActivity disables using navigation graph to navigate to it [oss-licenses-plugin] #140

Open KeyG89 opened 4 years ago

KeyG89 commented 4 years ago

Describe the bug As navigation to OssLicensesActivity using good old startActivity with an Intent works as a charm, using Navigation Graph to achieve the same goal seems counterproductive because of the obfuscation (I suppose).

To Reproduce

  1. Configure Open Source Notices as in the docs
  2. Instead of using startActivity, use `navController.navigate(YourFragment.navigateToOssLicensesActivity()) with properly prepead navigation graph xml

Expected behavior I guess If it wasn't for obfuscation, the activity should have been started.

Desktop:

Additional context Stacktrace:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.yyy.dev/com.google.android.gms.oss.licenses.OssLicensesActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.android.gms.internal.oss_licenses.zzc.toString()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.android.gms.internal.oss_licenses.zzc.toString()' on a null object reference at com.google.android.gms.oss.licenses.OssLicensesActivity.onCreate(Unknown Source:11) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:193)  at android.app.ActivityThread.main(ActivityThread.java:6669)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)  E/GmsClient: unable to connect to service: com.google.android.gms.oss.licenses.service.START on com.google.android.gms

ubuntudroid commented 4 years ago

Interestingly we only see this crash on Nexus 5x devices with Android 8.1.0.

emartynov commented 3 years ago

Any updates here? Looks like we also see it only on Nexus 5x and 8.1.0.

rimmer commented 2 years ago

We got a similar crash reported from Crashlytics on Pixel 3XL on Android 9. Looking forward for the fix

kwarklabs commented 2 years ago

Same error observed on LGE Nexus 5X running Android 8.1.0 when using startActivity(), so the problem isn't limited to when using navController.

autorunman22 commented 2 years ago

I got similar crash for Android 8.1.0 and device Nexus 5X

wakino commented 2 years ago

Similar error on Nexus 5X (Android 8.1.0) at com.google.android.gms.oss.licenses.OssLicensesActivity or android.content.res.ResourcesImpl.getResourcePackageName

smelfungus commented 2 years ago

Getting something similar on Nexus 5X Android 8.1.0:

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'long db6.y' on a null object reference
       at com.google.android.gms.internal.oss_licenses.zzc.zze(zzc.java:23)
       at com.google.android.gms.internal.oss_licenses.zze.zza(zze.java:19)
       at com.google.android.gms.oss.licenses.zzf.onComplete(zzf.java:28)
       at com.google.android.gms.tasks.zzi.run(zzi.java:1)
       at com.google.android.gms.measurement.internal.zzjx.run$bridge(com.google.android.gms:play-services-measurement@@21.1.1:764)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at androidx.loader.content.ModernAsyncTask$InternalHandler.dispatchMessage(ModernAsyncTask.java:6)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
almasmith commented 1 year ago

Any way to prevent this from happening? Nexus 5X 8.1.0:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gms.oss.licenses.OssLicensesActivity}: java.lang.NullPointerException: Attempt to read from field 'java.lang.String qn.b.a' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
leontodd commented 1 year ago

Similar issue only affecting Nexus 5X 8.1.0:

Caused by java.lang.NullPointerException: Attempt to read from field 'java.lang.String g7.b.D' on a null object reference
       at com.google.android.gms.internal.oss_licenses.zze.zzd(zze.java:43)
       at com.google.android.gms.oss.licenses.OssLicensesActivity.onCreate(OssLicensesActivity.java:43)
       at android.app.Activity.performCreate(Activity.java:7009)
       at android.app.Activity.performCreate(Activity.java:7000)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
lihenggui commented 1 year ago

The same issue in Nexus 5X 8.1.0 (From the Firebase report)

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.merxury.blocker/com.google.android.gms.oss.licenses.OssLicensesActivity}: java.lang.NullPointerException: Attempt to read from field 'java.lang.String z3.b.v' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
mgc-oka commented 1 year ago

Similar issue only affecting Nexus 5X 8.1.0: (From the Firebase report)

Caused by java.lang.NullPointerException: Attempt to read from field 'java.lang.String p6.b.v' on a null object reference
       at com.google.android.gms.internal.oss_licenses.zze.zzd(zze.java:42)
       at com.google.android.gms.oss.licenses.OssLicensesActivity.onCreate(com.google.android.gms:play-services-oss-licenses@@17.0.1:6)
       at android.app.Activity.performCreate(Activity.java:7009)
       at android.app.Activity.performCreate(Activity.java:7000)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
NamJa commented 9 months ago

similar issue reported only Nexus 5X.(from Sentry) Android Version 8.1.0

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.android.gms.internal.oss_licenses.zze.zzd()' on a null object reference
    at com.google.android.gms.oss.licenses.OssLicensesActivity.onCreate(com.google.android.gms:play-services-oss-licenses@@17.0.1:6)
    at android.app.Activity.performCreate(Activity.java:7009)
    at android.app.Activity.performCreate(Activity.java:7000)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.secondsyndrome.dalock/com.google.android.gms.oss.licenses.OssLicensesActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.android.gms.internal.oss_licenses.zze.zzd()' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
anonymouce commented 8 months ago

OS version: android8.1.0 Model:Nexus 5X Date:Mar 14, 2024, 9:42:36 AM

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'long y4.e.g()' on a null object reference at com.google.android.gms.internal.oss_licenses.zzf.zza(com.google.android.gms:play-services-oss-licenses@@17.0.1:1) at com.google.android.gms.oss.licenses.zzf.onComplete(com.google.android.gms:play-services-oss-licenses@@17.0.1:1) at com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.0.2:1) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

anonym24 commented 7 months ago

it's not related to using Context.startActivity() directly or navigation graph which anyways use Context.startActivity()...

I use it like this in Compose:

        Preference(
            title = stringResource(id = R.string.prefs_open_source_notices_text),
            icon = R.drawable.ic_open_source,
            onClick = {
                context.startActivity(Intent(context, OssLicensesMenuActivity::class.java))
            }
        )

and it crashes for Nexus 5 (a test device of Google Play to auto test each of your uploaded bundle to Google Play Console)

Caused by java.lang.NullPointerException
Attempt to read from field 'java.lang.String k9.b.B' on a null object reference
com.google.android.gms.internal.oss_licenses.zze.zzd (zze.java:43)
com.google.android.gms.oss.licenses.OssLicensesActivity.onCreate (com.google.android.gms:play-services-oss-licenses@@17.0.1:43)
android.app.Activity.performCreate (Activity.java:7009)
android.app.Activity.performCreate (Activity.java:7000)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1214)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2731)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2856)
android.app.ActivityThread.-wrap11
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1589)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:164)
android.app.ActivityThread.main (ActivityThread.java:6494)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)