question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firebase sqlite crash into write to a readonly database

See original GitHub issue
  • Android device: All android devices
  • Android OS version: M and above
  • Google Play Services version: 11.8.0
  • Firebase/Play Services SDK version: 11.8.0

Crash my application at some times due to the below log from firebase. I need to mentioned that I don’t have any sqlite database program in my application. So Please give me a solution.

E/UncaughtException: 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:780)
      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:1471)
      at bca.a(:com.google.android.gms.dynamite_dynamitemodulesc@14366046@14.3.66 (040306-213742215):61)
      at bcr.run(:com.google.android.gms.dynamite_dynamitemodulesc@14366046@14.3.66 (040306-213742215):17)
      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)
D/FA: Logging event (FE): app_exception(_ae), Bundle[{firebase_event_origin(_o)=crash, firebase_screen_class(_sc)=LoginActivity, firebase_screen_id(_si)=4554308083261849252, timestamp=1541757271065, fatal=1}]
V/FA: Recording user engagement, ms: 756
D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=756, firebase_screen_class(_sc)=LoginActivity, firebase_screen_id(_si)=4554308083261849252}]
E/SQLiteLog: (1032) statement aborts at 14: [INSERT INTO crash_reports(ts,fatal,payload,size) VALUES (?,?,?,?)] 
E/SQLiteDatabase: Error inserting ts=1541757271266 fatal=1 payload=[B@8d10d3d size=2661
  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:780)
      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:1471)
      at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1341)
      at bcp.run(:com.google.android.gms.dynamite_dynamitemodulesc@14366046@14.3.66 (040306-213742215):42)
      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)
  
  
>beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: pool-5-thread-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:780)
      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:1471)
      at bca.a(:com.google.android.gms.dynamite_dynamitemodulesc@14366046@14.3.66 (040306-213742215):61)
      at bcr.run(:com.google.android.gms.dynamite_dynamitemodulesc@14366046@14.3.66 (040306-213742215):17)
      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)
I/FirebaseCrash: Sending crashes
E/SQLiteLog: (1032) statement aborts at 18: [INSERT OR REPLACE  INTO config_table(config,value) VALUES (?,?)] 
E/UncaughtException: 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:780)
      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:1471)
      at bca.a(:com.google.android.gms.dynamite_dynamitemodulesc@14366046@14.3.66 (040306-213742215):61)
      at bcr.run(:com.google.android.gms.dynamite_dynamitemodulesc@14366046@14.3.66 (040306-213742215):17)
      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)
D/FA: Logging event (FE): app_exception(_ae), Bundle[{firebase_event_origin(_o)=crash, firebase_screen_class(_sc)=LoginActivity, firebase_screen_id(_si)=4554308083261849252, timestamp=1541757271339, fatal=1}]
E/SQLiteLog: (1032) statement aborts at 14: [INSERT INTO crash_reports(ts,fatal,payload,size) VALUES (?,?,?,?)] 
E/SQLiteDatabase: Error inserting ts=1541757271539 fatal=1 payload=[B@b41a6f5 size=2755
  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:780)
      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:1471)
      at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1341)
      at bcp.run(:com.google.android.gms.dynamite_dynamitemodulesc@14366046@14.3.66 (040306-213742215):42)
      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)
I/FirebaseCrash: Sending crashes

Steps to reproduce:

1 .Occuring at some time. No steps to reproduce.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
samtsterncommented, Jan 24, 2019

@macroday sorry about our lack of response here, we could have done a lot better.

I showed this to the right people and it looks like this crash comes from the old Firebase Crash Reporting, which has been deprecated. If you’re still using it in your app, remove it!

You’ll want to switch to Crashlytics, which won’t have this issue. Let me know if you have any questions about that.

0reactions
macrodaycommented, Nov 21, 2018

@firebase What happened team? This issue still exist in my app. Please provide at least a temporary solution to fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashed due to Firebase try to write crash report in read ...
Some time application has crashed because the firebase crash report try to store the value in the read only database.
Read more >
Firebase Apple SDK Release Notes - Google
Fixed a crash if multiple large write batches with overlapping documents were executed where at least one batch performed a delete operation (#9965)....
Read more >
SQLiteOpenHelper | Android Developers
In that case, a read-only database object will be returned. ... Write-ahead logging cannot be used with read-only databases so the value of...
Read more >
Fix the SQLite "attempt to write a readonly database" error
On seeing this, I used chmod to set the write bit for both user and group and reloaded the application, expecting to not...
Read more >
[Fixed]-Attempt to write a readonly SQLite database in Django
The first place that I would look for is whether or not the user who is running the Django app has write permissions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found