oliexdev / openScale

Open-source weight and body metrics tracker, with support for Bluetooth scales
GNU General Public License v3.0
1.72k stars 298 forks source link

Import failed #894

Closed c-key closed 1 year ago

c-key commented 2 years ago

Describe the bug I created a backup in phone A and transfer it to phone B. In phone B I want to import the backup via the menu. But it fails, see logcat. I habe in both phones the same and actual stable App Version.

To Reproduce See description above.

Reproduced with latest dev version: 2.4.6 (61)

Expected behavior I expect that the import will be finished without errors.

Additional context I bot no error message in the App, that something failed.

Debug log [10-31 12:39:37.702 11510:11510 E/SQLiteDatabase] Database corruption detected in open() android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed (code 11 SQLITE_CORRUPT): , while compiling: PRAGMA journal_mode at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1068) at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:811) at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:419) at android.database.sqlite.SQLiteConnection.setJournalFromConfiguration(SQLiteConnection.java:339) at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:268) at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:205) at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:512) at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:210) at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:202) at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1085) at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1065) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:929) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:918) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:380) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:323) at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:145) at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:106) at androidx.room.RoomDatabase.inTransaction(RoomDatabase.java:622) at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.java:399) at com.health.openscale.core.database.ScaleUserDAO_Impl.getAll(ScaleUserDAO_Impl.java:210) at com.health.openscale.core.OpenScale.getScaleUserList(OpenScale.java:171) at com.health.openscale.core.OpenScale.importDatabase(OpenScale.java:469) at com.health.openscale.gui.preferences.BackupPreferences.onActivityResult(BackupPreferences.java:175) at androidx.fragment.app.FragmentManager$7.onActivityResult(FragmentManager.java:2617) at androidx.fragment.app.FragmentManager$7.onActivityResult(FragmentManager.java:2597) at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:392) at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:351) at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:647) at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:140) at com.health.openscale.gui.MainActivity.onActivityResult(MainActivity.java:931) at android.app.Activity.dispatchActivityResult(Activity.java:8664) at android.app.ActivityThread.deliverResults(ActivityThread.java:5346) at android.app.ActivityThread.handleSendResult(ActivityThread.java:5392) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67) at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2309) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7904) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)

[10-31 12:39:37.702 11510:11510 E/SupportSQLite] Corruption reported by sqlite on database: /data/user/0/com.health.openscale/databases/openScale.db

oliexdev commented 1 year ago

I guess your openScale.db file is damaged. You can try to open it with any sql viewer, for e.g. https://sqlitebrowser.org/ if it works please send me the file then I will look into it.

c-key commented 1 year ago

I can open the sqlite DB without any problems in a sqlite viewer on my Android phone. How can I send you the file? I wouldn't post it here.

c-key commented 1 year ago

With Version 2.5.2 I can successfully import my old backup.