Quickstart-android: How do I make it work on mobile phones without Google service?

Created on 15 Jun 2018  路  15Comments  路  Source: firebase/quickstart-android

It's my build.gradle

implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-analytics:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-crash:16.0.0'
implementation 'com.google.firebase:firebase-perf:16.0.0'

and my android os verdion is android 8.0.0 (huawei), without google service
targetsdkversion 26
and then:

java.lang.SecurityException: Failed to find provider com.google.android.gsf.gservices for user 0; expected to find a valid ContentProvider for this authority
at android.os.Parcel.readException(Parcel.java:1945)
at android.os.Parcel.readException(Parcel.java:1891)
at android.content.IContentService$Stub$Proxy.registerContentObserver(IContentService.java:768)
at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1964)
at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1953)
at com.google.android.gms.internal.firebase-perf.zza.zza(Unknown Source:38)
at com.google.android.gms.internal.firebase-perf.zzq.(Unknown Source:145)
at com.google.android.gms.internal.firebase-perf.zzg.zzp(Unknown Source:127)
at com.google.android.gms.internal.firebase-perf.zzg.zzb(Unknown Source:0)
at com.google.android.gms.internal.firebase-perf.zzh.run(Unknown Source:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:784)

performance bug

All 15 comments

I think I've solved the problem.
In my build.gradle

implementation 'com.google.firebase:firebase-perf:16.0.0'

If I remove the perf锛宮y phone can work!!!

So,the perf sdk is a problem

There should be a way to use every firebase library without crashing on phones without Play Services. The libraries should just do nothing instead of making the app crash

@MMarco94 the app does not crash, that SecurityException is not a fatal app exception.

We would like to support all devices, but that's just not possible for some of our APIs right now. Google Play services can help us do things we would not otherwise be able to do (or if we could do them, they would not meet our performance / security / size standards)

I understand that some things need Play Services to work, but crashing is not the solution.
A user of our app is reporting that the app is crashing with the following stacktrace:

06-20 22:17:36.233 21005 21107 E AndroidRuntime: FATAL EXCEPTION: pool-6-thread-1
06-20 22:17:36.233 21005 21107 E AndroidRuntime: Process: xxxx.yyyy, PID: 21005
06-20 22:17:36.233 21005 21107 E AndroidRuntime: java.lang.SecurityException: Failed to find provider com.google.android.gsf.gservices for user 0; expected to find a valid ContentProvider for this authority
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:2004)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:1950)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at android.content.IContentService$Stub$Proxy.registerContentObserver(IContentService.java:768)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1924)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1913)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at com.google.android.gms.internal.firebase-perf.zza.zza(Unknown Source:38)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at com.google.android.gms.internal.firebase-perf.zzq.<init>(Unknown Source:143)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at com.google.android.gms.internal.firebase-perf.zzg.zzp(Unknown Source:126)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at com.google.android.gms.internal.firebase-perf.zzg.zzb(Unknown Source:0)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at com.google.android.gms.internal.firebase-perf.zzh.run(Unknown Source:2)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
06-20 22:17:36.233 21005 21107 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:764)

For what I can tell, a SecurityException is not different from any other exception, and it makes the app crash.

@MMarco94 I tried the sample in this repository on an emulator without Play services and could not observe a crash. Are you able to reproduce?

implementation 'com.google.firebase:firebase-perf:16.0.0'
You should add this, and you can reappear

@samtstern An user of my app reported the crash. I didn't try to reproduce it, since you recognized the problem here: https://github.com/firebase/quickstart-android/issues/534

@MMarco94 @LiuDongCai unless we can reproduce this there is no way to proceed. Obviously we don't want our APIs to crash on phones without Google services, and in my testing they do not crash.

@samtstern Please use HTC u11 锛宎ndroid 8.0

@samtstern I can reproduce this issue using the AOSP emulator image in the P SDK.
App crush if we have firebase-perf in the config.

@seventhmoon thank you! With your help I was able to reproduce it.

We've found the cause and a fix will come in a future version of the firebase-perf SDK. Thanks all!

@samtstern
crash immediately锛寃hen no google play service

FATAL EXCEPTION: pool-4-thread-1
Process: com.addcn.car8891, PID: 2474
java.lang.SecurityException: Failed to find provider com.google.android.gsf.gservices for user 0; expected to find a valid ContentProvider for this authority
at android.os.Parcel.readException(Parcel.java:1942)
at android.os.Parcel.readException(Parcel.java:1888)
at android.content.IContentService$Stub$Proxy.registerContentObserver(IContentService.java:768)
at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1924)
at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1913)
at com.google.android.gms.internal.zzdmf.zza(Unknown Source:35)
at com.google.android.gms.internal.zzdmf.zza(Unknown Source:3)
at com.google.android.gms.internal.zzewh.zzan(Unknown Source:126)
at com.google.android.gms.internal.zzewh.(Unknown Source:19)
at com.google.android.gms.internal.zzevz.zzcke(Unknown Source:151)
at com.google.android.gms.internal.zzevz.zzb(Unknown Source:0)
at com.google.android.gms.internal.zzewa.run(Unknown Source:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)

so, right now., fixed?

@xiyouMc upgrade firebase perf sdk to 1.6.2 should have the fix

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shivamsriva31093 picture shivamsriva31093  路  3Comments

UttamPanchasara picture UttamPanchasara  路  4Comments

udaysrinath picture udaysrinath  路  5Comments

fisache picture fisache  路  4Comments

wellbranding picture wellbranding  路  3Comments