应用程序因Firebase崩溃而尝试在只读数据库中写入崩溃报告

时间:2018-05-16 08:57:49

标签: android

某些时候应用程序崩溃了,因为firebase崩溃报告尝试将值存储在只读数据库中。我不知道为什么他们的数据库是只读的。请给我一个解决方案。

崩溃日志:

D: Logging event (FE): app_exception(_ae), Bundle[{firebase_event_origin(_o)=crash, firebase_screen_class(_sc)=SelectActivity, firebase_screen_id(_si)=-8244797341152687840, timestamp=1526448971529, fatal=1}]
V: Recording user engagement, ms: 1211
D: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=1211, firebase_screen_class(_sc)=SelectActivity, firebase_screen_id(_si)=-8244797341152687840}]
E: (1032) statement aborts at 13: [INSERT INTO crash_reports(size,payload,ts,fatal) VALUES (?,?,?,?)] attempt to write a readonly database
E: Error inserting size=10565 payload=[B@1f409e5 ts=1526448971731 fatal=1
    android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032)
        at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
        at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:783)
        at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
        at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
        at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1548)
        at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1417)
        at bbx.run(:com.google.android.gms.dynamite_dynamitemodulesc@12673025@12.6.73 (040408-194189626):45)
        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)

1 个答案:

答案 0 :(得分:-1)

要写入SqlDatabase,您需要使用getWritableDatabase()获取可写实例。如果这还没有解决,我们需要查看您的代码片段以获得更好的洞察力