I got the following Error when I tried to access data from firestore. Tried setting persistence to true yet getting the same error.
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.android.gms.internal.zzeyi.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.RuntimeException: Failed to gain exclusive lock to the Firestore client's offline persistence. This generally means you are using
Firestore from multiple processes in your app. Keep in mind that multi-
process Android apps execute the code in your Application class in all
processes, so you may need to avoid initializing Firestore in your
Application class. If you are intentionally using Firestore from multiple
processes, you can only enable offline persistence (i.e. call s
setPersistenceEnabled(true)) in one of them.
at com.google.android.gms.internal.zzetz.zza(Unknown Source)
at com.google.android.gms.internal.zzeqp.zza(Unknown Source)
at com.google.android.gms.internal.zzeqr.run(Unknown Source)
My App has a Service in it and running in a seperate process
<service
android:name=".ReceivingOrderService"
android:enabled="true"
android:exported="true"
android:process=":receivingorder"></service>
Sorry Guys I just played with code and set the
setPersistenceEnabled(true)
to
setPersistenceEnabled(false)
Related
I am using react native. I am getting the crashes on crashlytics with the error INVALID_STATE_ERR.I am using FireBase Crashlytics. I am also using MQTT client for making web socket connection.
I am not able to figure out the reason of crashing the app. Is it due to the MQTT WebSockets or due to the error occurring on javascript thread? I am also not getting any relevant message from the stack trace either.
I am pasting my Stack Trace below.
Fatal Exception: com.facebook.react.common.JavascriptException: INVALID_STATE_ERR, stack:
value#79:1340
_socket_send#557:21101
_on_socket_open#557:16408
<unknown>#557:628
value#63:1501
<unknown>#79:4566
value#32:1363
value#18:3559
<unknown>#18:1044
value#18:2986
value#18:1016
at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:148)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:818)
Can I get more insight to fix this issue?
According to this Wix GitHub issue, it is caused by:
Too many views on older phones. RNN added a few nested views, but it appears I may have too many anyways.
That issue links to a pull request on React Native's GitHub repo, which should now be merged in. It mentions the issue is on pre-API 21, so I suggest you try your code on later APIs and see if it persists.
Either way, reducing the number of views (or requests, in this case?) seems a good first step.
I've got a legacy app that's using Room that's crashing as soon as the first database query is executed, no matter what the query is.
java.lang.RuntimeException: Unable to start service com.someco.android.nettasks.PushQueueService#24ccdca6 with Intent { cmp=com.someco.android/.nettasks.PushQueueService }: android.database.sqlite.SQLiteException: Cannot execute this statement because it might modify the database but the connection is read-only.
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3439)
at android.app.ActivityThread.access$2200(ActivityThread.java:181)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1572)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6117)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: android.database.sqlite.SQLiteException: Cannot execute this statement because it might modify the database but the connection is read-only.
at io.requery.android.database.sqlite.SQLiteConnection.throwIfStatementForbidden(SQLiteConnection.java:1091)
at io.requery.android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:755)
at io.requery.android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:764)
at io.requery.android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:71)
at io.requery.android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1867)
at io.requery.android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1808)
at android.arch.persistence.room.RoomOpenHelper.createMasterTableIfNotExists(RoomOpenHelper.java:131)
at android.arch.persistence.room.RoomOpenHelper.checkIdentity(RoomOpenHelper.java:107)
at android.arch.persistence.room.RoomOpenHelper.onOpen(RoomOpenHelper.java:100)
at io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory$CallbackSQLiteOpenHelper.onOpen(RequerySQLiteOpenHelperFactory.java:67)
at io.requery.android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:283)
at io.requery.android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:174)
at io.requery.android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:44)
at com.someco.android.dmodel.OurDB.writableDb(OurDB.java:363)
at com.someco.android.nettasks.PushQueueService.startExecution(PushQueueService.java:202)
at com.someco.android.nettasks.PushQueueService.onStartCommand(PushQueueService.java:157)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3422)
at android.app.ActivityThread.access$2200(ActivityThread.java:181)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1572)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6117)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
From my investigations on the debugger, what's happening is that there's some sort of racing issue with regard to calls to sqlite3_stmt_readonly() in sqlite itself. This is the actual query that causes the crash, from RoomOpenHelper#createMastertableIfNotExists:
CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)
In RoomOpenHelper#onCreate, the table is created successfully. A statement seems to be compiled two times and checked for read-only status those two times:
Once in SQLiteProgram's constructor (via SQLiteStatement)
Once in SQLiteConnection#executeForChangedRowCount
What happens is that the connection fetched for the first one is opened with more permissive permissions (6, for me - 1 is the bit that denotes read-only status), and it's correctly evaluated to not be read-only. That means that the connection for the second statement compilation is requested with read-only flags (5, for me). The crash happens because for some reason, the query is evaluated to not be read-only once again.
I'm at a total loss for this one. Why does this crash? How is the same statement read-only sometimes and not read-only other times?
The problem is that room 1.0.0 does not support the Write-Ahead Log. I removed a line that enabled it in the app:
db.getOpenHelper().setWriteAheadLoggingEnabled(true);
The WAL is supported in version 1.1.0-alpha2. After trying out the new alpha, everything worked, so the change log pointed me to the answer. I've an example project with a brief write-up of the issue.
I recently checked for my GP crash logs and I am getting this callstack very frequently. Could you please help me.
A few things:
The failed to add asset path sometimes shows /data/app/com.xxx.xxx.xxx-x/base.apk and sometimes /mnt/asec/com.xxx.xxx.xxx-x/base.apk.
The device android versions (where it is reported) varies from Android 4.4. to Android 7.0
In the GP console, Android version shows Android 7.0 for all crashes but the device list has devices with Android version 6.0, 5.0, etc which is unclear.
I have two apps with shared user Id, say with package names P1, P2. For P1, the failed to add asset path sometimes shows /data/app/P2 and sometimes /mnt/asec/P1. Isn't this incorrect and what could cause this?
Call stacks:
java.lang.RuntimeException: Unable to create BackupAgent android.app.backup.FullBackupAgent: android.content.res.Resources$NotFoundException: failed to add asset path data/app/com.P2.xxx/base.apk
at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:3452)
at android.app.ActivityThread.-wrap5(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1796)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: android.content.res.Resources$NotFoundException: failed to add asset path /data/app/com.P2.xxx/base.apk
at android.app.ResourcesManager.createAssetManager(ResourcesManager.java:281)
at android.app.ResourcesManager.createResourcesImpl(ResourcesManager.java:359)
at android.app.ResourcesManager.getOrCreateResources(ResourcesManager.java:638)
at android.app.ResourcesManager.getResources(ResourcesManager.java:730)
at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2068)
at android.app.LoadedApk.getResources(LoadedApk.java:780)
at android.app.ContextImpl.<init>(ContextImpl.java:2244)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2184)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2175)
at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:3422)
Another crash:
android.content.res.Resources$NotFoundException: failed to add asset path /mnt/asec/com.P1.xxx/base.apk
at android.app.ResourcesManager.createAssetManager(ResourcesManager.java:281)
at android.app.ResourcesManager.createResourcesImpl(ResourcesManager.java:359)
at android.app.ResourcesManager.getOrCreateResources(ResourcesManager.java:638)
at android.app.ResourcesManager.getResources(ResourcesManager.java:730)
at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2052)
at android.app.LoadedApk.getResources(LoadedApk.java:787)
at android.app.ContextImpl.<init>(ContextImpl.java:2266)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2210)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2196)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5861)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
Please check if the App has external drive permissions.
In my case this issue triggered when ADB installed the App to the device which is screen locked, the same test has passed when the device is awake, so even though permissions available to this App
I have this error for com.android.billingclient:billing. Problem is "there is no account in the device", for example a new device or reset to vendor settings.
So just add an account in global settings.
I am using firebase offline database for my android app, in PreferenceScreen and load dynamic config data.
compile 'com.google.firebase:firebase-database:9.8.0'
Using it as:
FirebaseDatabase.getInstance().getReference(fireBaseReference);
I am using it as per tutorial: https://firebase.google.com/docs/database/
App works fine when it is connected, on offline it is crashing with below stack trace
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.nishant.starterkit.mock.
Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
Seems like your app has multiple process. Make sure you initialize firebase database only through Context of your application.
if (!FirebaseApp.getApps(this).isEmpty()) {
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
}
You should initialize firebase DB as mentioned above.
I need the Error logs with stack trace from my users with my Android App (Debug, deployed via DeployGate). I've tried DeployGate SDK and RemoteLogCat. RemoteLogCat and DeployGate only send Log messages that I've put in myself, but I need the current LogCat data (as if it would be hooked up to my own PC) with LogLevel "Error".
This is what I need:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: www.myapp.nl.simpelfragmentvoorbeeld, PID: 5020
java.lang.RuntimeException: NullPointerException
at www.myapp.nl.MainActivity$1.onClick(MainActivity.java:87)
at android.view.View.performClick(View.java:5197)
at android.view.View$PerformClick.run(View.java:20926)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5944)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.
run(ZygoteInit.java:1389)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)
Many thanks guys!
The solution is using ACRA
ACRA is a library enabling Android Application to automatically post their crash reports to a GoogleDoc form. It is targetted to android applications developers to help them get data from their applications when they crash or behave erroneously.