Projects
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}
Module
dependencies {
compile 'com.google.android.gms:play-services-analytics:10.0.0'
}
It just happened in 8.0 system, but i haven't used any firebase code in my project
Fatal Exception: java.lang.IllegalStateException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gsf (has extras) }: app is in background uid UidRecord{e2ab7c6 u0a30 CEM idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1538)
at android.app.ContextImpl.startService(ContextImpl.java:1484)
at android.content.ContextWrapper.startService(ContextWrapper.java:663)
at com.google.firebase.iid.zzf.zzbi(Unknown Source:149)
at com.google.firebase.iid.zzf.zzbi(Unknown Source:235)
at com.google.firebase.iid.zzf.zzt(Unknown Source:20)
at com.google.firebase.iid.zzf.zzbi(Unknown Source)
at com.google.firebase.iid.zzd.zzGu(Unknown Source:57)
at com.google.firebase.iid.zzd.getCreationTime(Unknown Source:49)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source:3)
at com.google.firebase.iid.FirebaseInstanceId.zzaae(Unknown Source:4)
at com.google.firebase.iid.FirebaseInstanceIdService.zzH(Unknown Source:37)
at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source:35)
at com.google.firebase.iid.zzb$2.run(Unknown Source:4)
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)
I can't remove firebase from my project, is there other ways to solve this problem?
Fabric report
You should first try on the main menu, choose File | Invalidate Caches/Restart. this can happen if Android studio gets in a bad state.
It should also be noted that firebase is probably in play-services-analytics. Ever since google bought them out they have put firebase in many of their google play services libraries.
Related
When I leave the Google Places API on idle after initialization, the application crashes with the stack trace as described at the end of this description.
I initialize the Places API once and only once in the manner described below
if(!Places.isInitialized()) {
val apiKey = loadApiKey()
Places.initialize(getApplication(), apiKey)
}
val client = Places.createClient(getApplication())
After running the above method and left on idle, the application crashes with the following stack trace.
I am assuming this is happening because of a clash between my javalite libraries and the protobuf java libraries.
java.lang.ExceptionInInitializerError
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1)
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.RuntimeException: Unable to get message info for com.google.android.datatransport.cct.a.zze
at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:62)
at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:143)
at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:55)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107)
at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:175)
at com.google.android.datatransport.cct.a.zze.<clinit>(com.google.android.datatransport:transport-backend-cct##2.1.0:2)
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1)
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.UnsupportedOperationException
at com.google.android.datatransport.cct.a.zze.dynamicMethod(com.google.android.datatransport:transport-backend-cct##2.1.0:2)
at com.google.protobuf.GeneratedMessageLite.dynamicMethod(GeneratedMessageLite.java:256)
at com.google.protobuf.GeneratedMessageLite.buildMessageInfo(GeneratedMessageLite.java:284)
at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:60)
at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:143)
at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:55)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107)
at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:175)
at com.google.android.datatransport.cct.a.zze.<clinit>(com.google.android.datatransport:transport-backend-cct##2.1.0:2)
at com.google.android.datatransport.cct.a.zze.zzb(com.google.android.datatransport:transport-backend-cct##2.1.0:1)
at com.google.android.datatransport.cct.zzc.send(com.google.android.datatransport:transport-backend-cct##2.1.0:9)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.logAndUpdateState(com.google.android.datatransport:transport-runtime##2.1.0:121)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader.lambda$upload$1(com.google.android.datatransport:transport-runtime##2.1.0:88)
at com.google.android.datatransport.runtime.scheduling.jobscheduling.Uploader$$Lambda$1.run(Unknown Source:8)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
There might be an issue with the library's protobuffer integration clashing with the one I am using within my application.
As per this issue tracker I created and mentioned by the comments.
https://issuetracker.google.com/issues/161157921.
For now, simply add the following to update the internal Places dependencies on Protobufer libraries until they push out a Places version > 2.3.0
implementation 'com.google.android.datatransport:transport-runtime:2.2.3'
implementation 'com.google.android.datatransport:transport-backend-cct:2.3.0'
This is my application class:
package com.example.myapp
import android.support.multidex.MultiDexApplication
import com.facebook.appevents.AppEventsLogger
import com.google.firebase.FirebaseApp
import com.google.firebase.FirebaseOptions
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.FirebaseFirestoreSettings
class App : MultiDexApplication() {
override fun onCreate() {
super.onCreate()
// Facebook
AppEventsLogger.activateApp(this)
// Firebase
FirebaseApp.initializeApp(this)
val settings = FirebaseFirestoreSettings.Builder()
.setPersistenceEnabled(false)
.setTimestampsInSnapshotsEnabled(true)
.build()
FirebaseFirestore.getInstance().firestoreSettings = settings
}
}
This is the error I'm getting. It's failing on the last line of the App class, FirebaseFirestore.getInstance(), saying it's not initialized, but you can see above that I am initializing it?
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapp, PID: 8328
java.lang.RuntimeException: Unable to create application com.example.myapp.App: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.myapp. Make sure to call FirebaseApp.initializeApp(Context) first.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5876)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
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.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.myapp. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common##16.0.1:219)
at com.google.firebase.firestore.FirebaseFirestore.getInstance(com.google.firebase:firebase-firestore##17.0.5:49)
at com.example.myapp.App.onCreate(App.kt:31)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
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)
Does anybody know what I need to do to fix this?
This is an instant app. I have put the google services json inside every module (base + app + instant) and have also added the plugin to each gradle.
It's just weird that it's obviously going past the initialize statement and still failing.
For me none of the solution worked that were given any where. Only this worked.
Just had to download grade my google services from 4.1.0 to 4.0.0
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha08'
classpath 'com.google.gms:google-services:4.0.0'
/*classpath 'com.google.gms:google-services:4.1.0' <-- this was the problem */
}
So if you have updated the google services, just try to downgrade or change to an older version.
This worked for me..
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.2.0'
With Android 0 (DP4 in my case) and the 3.5.8 version of SDK, I have a crash on every boot of the device.
The crash is the following :
Caused by:
java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.frandroid.app/com.onesignal.NotificationRestoreService (has extras) }: app is in background uid UidRecord{c74919a u0a125 RCVR idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1505)
at android.app.ContextImpl.startService(ContextImpl.java:1461)
at android.content.ContextWrapper.startService(ContextWrapper.java:644)
at android.content.ContextWrapper.startService(ContextWrapper.java:644)
at android.support.v4.content.WakefulBroadcastReceiver.startWakefulService(WakefulBroadcastReceiver.java:100)
at com.onesignal.BootUpReceiver.onReceive(BootUpReceiver.java:42)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3252)
at android.app.ActivityThread.-wrap17(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
This crash is related to Android O / 8.0.
This has been asked at the One signal issues
#jkasten2 answers:
// Add snapshots repo if you don't have it already
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
compile 'com.onesignal:OneSignal:4.0.0-SNAPSHOT'
He has also mentioned:
From feedback from others and our own testing the beta has been stable. We are finishing our final testing and we are shooting for a release sometime next week.
Although the core issue is addressed by #Swati.
Update:
The ticket has been closed by OneSignal team, following is the fix (as updated in the one signal documentation):
dependencies {
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
}
WakefulBroadcastReceiver is deprecated in Android O -
"It is generally not safe to start a service from the receipt of a broadcast, because you don't have any guarantees that your app is in the foreground at this point and thus allowed to do so."
You might need to check https://developer.android.com/preview/behavior-changes.html#back-all
I am using Firebase Crash Reporting and Firebase Remote Config, but I am not using Firebase Cloud Messaging. Version of both is 9.8.0.
So, I don't understand why am I seeing this error in logs:
java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1266)
at android.app.ContextImpl.startService(ContextImpl.java:1243)
at android.content.ContextWrapper.startService(ContextWrapper.java:588)
at com.google.firebase.iid.zzf.zzb(Unknown Source)
at com.google.firebase.iid.zzf.zza(Unknown Source)
at com.google.firebase.iid.zzf.zzb(Unknown Source)
at com.google.firebase.iid.zzf.zza(Unknown Source)
at com.google.firebase.iid.zzd.zzc(Unknown Source)
at com.google.firebase.iid.zzd.getToken(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getToken(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.zzaae(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zza(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source)
at com.google.firebase.iid.zzb$2.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Could it be, because I am depending on Google Cloud Messaging (but not using - library dependency - internal company library)?
Does it have any serious consequences?
As mentioned by Doug Stevenson in this groups post, the RECEIVE, C2D_MESSAGE, and WAKE_LOCK permissions are required by Analytics, Crash Reporting, and Remote Config.
The primary use is to generate secure tokens and, in the case of WAKE_LOCK, to prevent data loss, by keeping Android from killing the app's process before it's able to transmit collected data.
Recently I got feedback and also I was able to reproduce it easily on my Nexus 5 with cleared app data.
Simply, when adding compile 'com.google.firebase:firebase-crash:9.4.0' only to project dependencies I get following Exception:
09-14 00:47:54.899 3129-3129/com.szyk.myheart E/FirebaseCrash: Failed to initialize crash reporting
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
at bol.<init>(:com.google.android.gms.DynamiteModulesC:3201)
at com.google.firebase.crash.internal.api.FirebaseCrashApiImpl.init(:com.google.android.gms.DynamiteModulesC:67)
at bnu.onTransact(:com.google.android.gms.DynamiteModulesC:60)
at android.os.Binder.transact(Binder.java:387)
at com.google.firebase.crash.internal.zzd$zza$zza.zza(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.<init>(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzek(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
The issue is more stranger, because once it will produce ANR and crash, then it works in next launches.
My dependencies:
compile 'com.google.firebase:firebase-core:9.4.0'
//not working compile 'com.google.firebase:firebase-crash:9.4.0'
compile 'com.google.firebase:firebase-invites:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-plus:9.4.0'
compile 'com.google.android.gms:play-services-drive:9.4.0'
The issue has been introduced with the Google Play Services 9.6.80 (currently in rollout) and affects all the apps using the Firebase Crash reporting (despite of the version bundled in your app).
Temporary solution: disable Firebase Crash by removing the following entry from the build.gradle:
compile 'com.google.firebase:firebase-crash:9.x.x'
Long term solution: wait that Google releases a fixed version of the GPS before enabling Firebase Crash again.
UPDATE 09/16:
Google is rolling out a fixed version of Google Play Services (9.6.83) which addresses the issue with Firebase Crash.
Disable the Firebase Analytics Crash Reporting, use the below code inside app.gradle file.Hope this will help you
configurations {
all*.exclude group: 'com.google.firebase', module: 'firebase-crash'
}
9.6.83 still gives a different anr crash
Our app when pushed to Play Store Beta and when installed on devices crashes the first time on launch. Subsequently it works , but we cannot push to prod without understanding the issue.
Here is the ANR crash report
java.lang.RuntimeException: Unable to instantiate receiver com.google.android.gms.analytics.CampaignTrackingReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.analytics.CampaignTrackingReceiver"
Edit : We had to add compile 'com.google.android.gms:play-services-analytics:9.4.0' explicitly and the launch anr for first time got resolved. But I am not sure that was the fix as we dont use the library at all. Maybe Playstore fixed their bug to all apks?
Just for the record:
We solved the DynamiteModulesC NPE and Uncaught exception in Firebase runloop (3.0.0) by removing following line
//remove this "feature" if you should use it
FirebaseApp.setAutomaticResourceManagmentEnabled(true)
API description:
If set to true it indicates that Firebase should close database
connections automatically when the app is in the background. Disabled
by default.
(Might be, that we missed some configurations for correct usage of this feature, but App is working as expected after not enabling the ResourceManagment)