0

I'm working with the Twitter Android application in an x86, Android 7.0, emulated environment, attempting to handle login sessions by cloning and restoring the application's data on disk.

For some reason, when tarring /data/data/com.twitter.android/databases, then immediately extracting that tarball back to the same place (so as to overwrite the files with copies of themselves), the application becomes bricked, crashing on startup until I do a full reinstall of the app. The same is true if I simply cp -rp the directory elsewhere, remove it, then restore it from the copy with cp -rp again.

This can be replicated by installing the Twitter application, logging in manually, then running the following from /data/data/com.twitter.android/ in an adb shell with escalated privileges (adb root):

generic_x86:/data/data/com.twitter.android # (ls -la databases; tar -cf /sdcard/db.tar databases; tar -xpf /sdcard/db.tar; ls -la databases)

ls -la before tar:
total 3200
drwxrwx--x 2 u0_a98 u0_a98   4096 2018-04-13 21:52 .
drwx------ 9 u0_a98 u0_a98   4096 2018-04-13 21:51 ..
-rw-rw---- 1 u0_a98 u0_a98 512000 2018-04-13 21:52 0-49.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 0-49.db-journal
-rw-rw---- 1 u0_a98 u0_a98  28672 2018-04-13 21:52 0-lru_key_value.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 0-lru_key_value.db-journal
-rw-rw---- 1 u0_a98 u0_a98  16384 2018-04-13 21:52 0-scribe.db
-rw------- 1 u0_a98 u0_a98  16928 2018-04-13 21:52 0-scribe.db-journal
-rw-rw---- 1 u0_a98 u0_a98 638976 2018-04-13 21:52 984053504628150273-49.db
-rw------- 1 u0_a98 u0_a98  74384 2018-04-13 21:52 984053504628150273-49.db-journal
-rw-rw---- 1 u0_a98 u0_a98  20480 2018-04-13 21:52 984053504628150273-dm.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 984053504628150273-dm.db-journal
-rw-rw---- 1 u0_a98 u0_a98  20480 2018-04-13 21:52 984053504628150273-drafts.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 984053504628150273-drafts.db-journal
-rw-rw---- 1 u0_a98 u0_a98  28672 2018-04-13 21:52 984053504628150273-lru_key_value.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 984053504628150273-lru_key_value.db-journal
-rw-rw---- 1 u0_a98 u0_a98  40960 2018-04-13 21:52 984053504628150273-scribe.db
-rw------- 1 u0_a98 u0_a98  12824 2018-04-13 21:52 984053504628150273-scribe.db-journal
-rw-rw---- 1 u0_a98 u0_a98  16384 2018-04-13 21:52 evernote_jobs.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 evernote_jobs.db-journal
-rw-rw---- 1 u0_a98 u0_a98  36864 2018-04-13 21:52 global.db
-rw------- 1 u0_a98 u0_a98  12824 2018-04-13 21:52 global.db-journal
-rw-rw---- 1 u0_a98 u0_a98  16384 2018-04-13 21:52 google_app_measurement_local.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 google_app_measurement_local.db-journal
-rw-rw---- 1 u0_a98 u0_a98  16384 2018-04-13 21:51 persistent_jobs.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:51 persistent_jobs.db-journal

ls -la after tar extraction:

total 3184
drwxrwx--x 2 u0_a98 u0_a98   4096 2018-04-13 21:52 .
drwx------ 9 u0_a98 u0_a98   4096 2018-04-13 21:51 ..
-rw-rw---- 1 u0_a98 u0_a98 512000 2018-04-13 21:52 0-49.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 0-49.db-journal
-rw-rw---- 1 u0_a98 u0_a98  28672 2018-04-13 21:52 0-lru_key_value.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 0-lru_key_value.db-journal
-rw-rw---- 1 u0_a98 u0_a98  16384 2018-04-13 21:52 0-scribe.db
-rw------- 1 u0_a98 u0_a98  16928 2018-04-13 21:52 0-scribe.db-journal
-rw-rw---- 1 u0_a98 u0_a98 638976 2018-04-13 21:52 984053504628150273-49.db
-rw------- 1 u0_a98 u0_a98  74384 2018-04-13 21:52 984053504628150273-49.db-journal
-rw-rw---- 1 u0_a98 u0_a98  20480 2018-04-13 21:52 984053504628150273-dm.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 984053504628150273-dm.db-journal
-rw-rw---- 1 u0_a98 u0_a98  20480 2018-04-13 21:52 984053504628150273-drafts.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 984053504628150273-drafts.db-journal
-rw-rw---- 1 u0_a98 u0_a98  28672 2018-04-13 21:52 984053504628150273-lru_key_value.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 984053504628150273-lru_key_value.db-journal
-rw-rw---- 1 u0_a98 u0_a98  40960 2018-04-13 21:52 984053504628150273-scribe.db
-rw------- 1 u0_a98 u0_a98  12824 2018-04-13 21:52 984053504628150273-scribe.db-journal
-rw-rw---- 1 u0_a98 u0_a98  16384 2018-04-13 21:52 evernote_jobs.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 evernote_jobs.db-journal
-rw-rw---- 1 u0_a98 u0_a98  36864 2018-04-13 21:52 global.db
-rw------- 1 u0_a98 u0_a98  12824 2018-04-13 21:52 global.db-journal
-rw-rw---- 1 u0_a98 u0_a98  16384 2018-04-13 21:52 google_app_measurement_local.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:52 google_app_measurement_local.db-journal
-rw-rw---- 1 u0_a98 u0_a98  16384 2018-04-13 21:51 persistent_jobs.db
-rw------- 1 u0_a98 u0_a98   8720 2018-04-13 21:51 persistent_jobs.db-journal

As you can see, the output of the two ls executions are nearly identical, all permissions are preserved, however the size of the directory after tar creation and subsequent extraction is smaller than before, I figure this is just the OS optimising the number of disk blocks used though?

I have searched the whole filesystem for soft links to the directory in question and have come up with nothing. You can also see from the output of ls -la that the directory only has 2 hard links (one from .../databases/ and one from it's own '.' entry), so I'm pretty sure no links are being destroyed.

I'm doing all of this when the application is not running, and I've tried restarting the system inbetween replacing the files with copies of themselves and starting the application. I've also tried on Android 8.0, and 7.1.1 with the results.

I'm very confused as to what's causing this haha, any help/ideas are greatly appreciated.

-----------------------------------------------UPDATE--------------------------------------------------------

Don't know why it took me so long to think to check logcat (duhhhh):

04-14 16:50:12.417: E/SQLiteLog(8473): (14) cannot open file at line 35652 of [8201f4e1c5]
04-14 16:50:12.417: E/SQLiteLog(8473): (14) os_unix.c:35652: (13) open(/data/user/0/com.twitter.android/databases/persistent_jobs.db) - 
04-14 16:50:12.420: E/SQLiteDatabase(8473): Failed to open database '/data/user/0/com.twitter.android/databases/persistent_jobs.db'.
04-14 16:50:12.420: E/SQLiteDatabase(8473): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:723)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:299)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:254)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:218)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at com.twitter.database.BaseDatabaseHelper.a(Twttr:280)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at com.twitter.database.BaseDatabaseHelper.getReadableDatabase(Twttr:262)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at ewg.b(Twttr:274)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at ewg.f(Twttr:246)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at ewj$a.b(Twttr:217)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at ewj$a.c(Twttr:199)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at com.twitter.async.operation.AsyncOperation.a(Twttr:319)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at com.twitter.async.operation.b.call(Unknown Source:4)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at com.twitter.util.errorreporter.a.a(Twttr:93)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at com.twitter.async.operation.AsyncOperation.ag(Twttr:317)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at dsq$a.run(Twttr:257)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
04-14 16:50:12.420: E/SQLiteDatabase(8473):     at java.lang.Thread.run(Thread.java:764)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473): Couldn't open persistent_jobs.db for writing (will try read-only):
04-14 16:50:12.421: E/SQLiteOpenHelper(8473): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:723)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:299)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:254)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:218)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at com.twitter.database.BaseDatabaseHelper.a(Twttr:280)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at com.twitter.database.BaseDatabaseHelper.getReadableDatabase(Twttr:262)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at ewg.b(Twttr:274)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at ewg.f(Twttr:246)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at ewj$a.b(Twttr:217)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at ewj$a.c(Twttr:199)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at com.twitter.async.operation.AsyncOperation.a(Twttr:319)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at com.twitter.async.operation.b.call(Unknown Source:4)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at com.twitter.util.errorreporter.a.a(Twttr:93)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at com.twitter.async.operation.AsyncOperation.ag(Twttr:317)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at dsq$a.run(Twttr:257)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
04-14 16:50:12.421: E/SQLiteOpenHelper(8473):   at java.lang.Thread.run(Thread.java:764)
04-14 16:50:12.422: E/SQLiteLog(8473): (14) cannot open file at line 35652 of [8201f4e1c5]
04-14 16:50:12.422: E/SQLiteLog(8473): (14) os_unix.c:35652: (13) open(/data/user/0/com.twitter.android/databases/persistent_jobs.db) - 
04-14 16:50:12.422: E/SQLiteLog(8473): (14) cannot open file at line 35652 of [8201f4e1c5]
04-14 16:50:12.423: E/SQLiteLog(8473): (14) os_unix.c:35652: (13) open(/data/user/0/com.twitter.android/databases/evernote_jobs.db) - 
04-14 16:50:12.423: E/SQLiteDatabase(8473): Failed to open database '/data/user/0/com.twitter.android/databases/evernote_jobs.db'.
04-14 16:50:12.423: E/SQLiteDatabase(8473): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:723)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:299)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:254)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:194)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at com.evernote.android.job.f.a(Twttr:130)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at com.evernote.android.job.d.a(Twttr:242)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at ewa.l(Twttr:87)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at com.twitter.android.initialization.JobScheduleInitializer.a(Twttr:28)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at com.twitter.android.initialization.JobScheduleInitializer.a(Twttr:17)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at dez.a(Twttr:72)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at dfa.run(Unknown Source:6)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at io.reactivex.internal.operators.completable.c.b(Twttr:34)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at io.reactivex.a.a(Twttr:1686)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(Twttr:64)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at io.reactivex.u$a.run(Twttr:452)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at io.reactivex.internal.schedulers.ScheduledRunnable.run(Twttr:66)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at io.reactivex.internal.schedulers.ScheduledRunnable.call(Twttr:57)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
04-14 16:50:12.423: E/SQLiteDatabase(8473):     at java.lang.Thread.run(Thread.java:764)
04-14 16:50:12.423: E/JobStorage(8473): could not load all jobs
04-14 16:50:12.423: E/JobStorage(8473): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
04-14 16:50:12.423: E/JobStorage(8473):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:723)
04-14 16:50:12.423: E/JobStorage(8473):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:299)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:254)
04-14 16:50:12.423: E/JobStorage(8473):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:194)
04-14 16:50:12.423: E/JobStorage(8473):     at com.evernote.android.job.f.a(Twttr:130)
04-14 16:50:12.423: E/JobStorage(8473):     at com.evernote.android.job.d.a(Twttr:242)
04-14 16:50:12.423: E/JobStorage(8473):     at ewa.l(Twttr:87)
04-14 16:50:12.423: E/JobStorage(8473):     at com.twitter.android.initialization.JobScheduleInitializer.a(Twttr:28)
04-14 16:50:12.423: E/JobStorage(8473):     at com.twitter.android.initialization.JobScheduleInitializer.a(Twttr:17)
04-14 16:50:12.423: E/JobStorage(8473):     at dez.a(Twttr:72)
04-14 16:50:12.423: E/JobStorage(8473):     at dfa.run(Unknown Source:6)
04-14 16:50:12.423: E/JobStorage(8473):     at io.reactivex.internal.operators.completable.c.b(Twttr:34)
04-14 16:50:12.423: E/JobStorage(8473):     at io.reactivex.a.a(Twttr:1686)
04-14 16:50:12.423: E/JobStorage(8473):     at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(Twttr:64)
04-14 16:50:12.423: E/JobStorage(8473):     at io.reactivex.u$a.run(Twttr:452)
04-14 16:50:12.423: E/JobStorage(8473):     at io.reactivex.internal.schedulers.ScheduledRunnable.run(Twttr:66)
04-14 16:50:12.423: E/JobStorage(8473):     at io.reactivex.internal.schedulers.ScheduledRunnable.call(Twttr:57)
04-14 16:50:12.423: E/JobStorage(8473):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
04-14 16:50:12.423: E/JobStorage(8473):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
04-14 16:50:12.423: E/JobStorage(8473):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
04-14 16:50:12.423: E/JobStorage(8473):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
04-14 16:50:12.423: E/JobStorage(8473):     at java.lang.Thread.run(Thread.java:764)
04-14 16:50:12.430: E/SQLiteLog(8473): (14) cannot open file at line 35652 of [8201f4e1c5]
04-14 16:50:12.430: E/SQLiteLog(8473): (14) os_unix.c:35652: (13) open(/data/user/0/com.twitter.android/databases/evernote_jobs.db) - 
04-14 16:50:12.432: E/SQLiteDatabase(8473): Failed to open database '/data/user/0/com.twitter.android/databases/persistent_jobs.db'.
04-14 16:50:12.432: E/SQLiteDatabase(8473): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:265)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:218)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at com.twitter.database.BaseDatabaseHelper.a(Twttr:280)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at com.twitter.database.BaseDatabaseHelper.getReadableDatabase(Twttr:262)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at ewg.b(Twttr:274)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at ewg.f(Twttr:246)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at ewj$a.b(Twttr:217)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at ewj$a.c(Twttr:199)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at com.twitter.async.operation.AsyncOperation.a(Twttr:319)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at com.twitter.async.operation.b.call(Unknown Source:4)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at com.twitter.util.errorreporter.a.a(Twttr:93)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at com.twitter.async.operation.AsyncOperation.ag(Twttr:317)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at dsq$a.run(Twttr:257)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
04-14 16:50:12.432: E/SQLiteDatabase(8473):     at java.lang.Thread.run(Thread.java:764)
04-14 16:50:12.438: E/SQLiteDatabase(8473): Failed to open database '/data/user/0/com.twitter.android/databases/evernote_jobs.db'.
04-14 16:50:12.438: E/SQLiteDatabase(8473): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:723)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:299)
04-14 16:50:12.438: E/SQLiteDatabase(8473):     at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:254)
....

So somehow replacing the SQLite databases in /data/data/com.twitter.android/databases affects the databases in /data/user/0/com.twitter.android/databases/.

Deleting the files in either directory has the effect of deleting them in the other directory, suggesting they're hard linked - but I can't see that they are. Also deleting all the files inside either databases directory has no effect - the app starts normally and the db files are restored from somewhere.

  • Instead of using tar (it's never a good idea to fiddle with the files of an application still running), why not using adb backup and adb restore? You can restrict that to a single app's data. Of course, the app must allow for backups (and not have opted out). – Izzy Apr 14 '18 at 10:59
  • @Izzy Thanks for the suggestion. Unfortunately the app doesn't allow backups. I've tried with a rooted device & Titanium backup, but I get a similar problem in that the restored application crashes at startup every time. – harry songhurst Apr 14 '18 at 11:14
  • Already feared that being the case. On a rooted device with Xposed installed, you could try it with the BackupAllApps module (which should make adb backup ignore the AllowBackup flag). – Izzy Apr 14 '18 at 11:38
  • Just tried that now. The Xposed module definitely bypassed the AllowBackup flag as the backup is ~25mb. However on uninstalling the Twitter app, then reinstalling, then restoring the backup data, the same thing happens - the application crashes on startup. Confusing huh! – harry songhurst Apr 14 '18 at 12:24
  • Indeed confusing. And that's the end of my "wisdom" on this … so someone else has to pick up. Good luck! – Izzy Apr 14 '18 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.