mtotschnig / MyExpenses

GPL licenced Android Expense Tracking App
http://www.myexpenses.mobi/
GNU General Public License v3.0
847 stars 222 forks source link

[Crash] App crashes post update 3.8.8 -> 3.8.9 #1578

Closed Alphaspiderman closed 1 month ago

Alphaspiderman commented 1 month ago

Brief Intro

I had just updated from 3.8.8 (757) to 3.8.9 (759) and on launching the application, it crashes instantly.

What device logs indicate

The cause of the crash is a database upgrade failure, caused by attempting to work on a debt that has been marked as closed. I have attached the related part of the devices log at the end.

How to fix the issue as a user

Logs for Reference

org.totschnig.myexpenses.provider.TransactionDatabase$SQLiteUpgradeFailedException: Upgrade failed  168 -> 170
    at org.totschnig.myexpenses.provider.TransactionDatabase.g(TransactionDatabase.java:4205)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onUpgrade(FrameworkSQLiteOpenHelper.kt:15)
    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:416)
    at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:340)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.d(FrameworkSQLiteOpenHelper.kt:13)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.e(FrameworkSQLiteOpenHelper.kt:64)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.a(FrameworkSQLiteOpenHelper.kt:24)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getReadableDatabase(FrameworkSQLiteOpenHelper.kt:10)
    at org.totschnig.myexpenses.provider.TransactionProvider.query(TransactionProvider.java:2)
    at android.content.ContentProvider.query(ContentProvider.java:1420)
    at android.content.ContentProvider.query(ContentProvider.java:1516)
    at android.content.ContentProvider$Transport.query(ContentProvider.java:277)
    at android.content.ContentResolver.query(ContentResolver.java:1221)
    at android.content.ContentResolver.query(ContentResolver.java:1152)
    at android.content.ContentResolver.query(ContentResolver.java:1108)
    at H1.a.run(Query.kt:13)
    at app.cash.copper.flow.FlowContentResolver$mapToList$$inlined$transform$1$1$lambda$1.invokeSuspend(FlowContentResolver.kt:12)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
    at kotlinx.coroutines.S.run(DispatchedTask.kt:107)
    at Z9.h$a.run(LimitedDispatcher.kt:4)
    at ba.g.run(Tasks.kt:3)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$b.run(CoroutineScheduler.kt:93)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [D0{Cancelling}@b712e07, Dispatchers.Main.immediate]
Caused by: android.database.sqlite.SQLiteConstraintException: attempt to update sealed debt (code 1811 SQLITE_CONSTRAINT_TRIGGER)
    at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method)
    at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:892)
    at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:756)
    at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:67)
    at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.update(FrameworkSQLiteDatabase.kt:148)
    at org.totschnig.myexpenses.provider.y.w(MoreDbUtils.kt:22)
    at org.totschnig.myexpenses.provider.h.V(BaseTransactionDatabase.kt:92)
    at org.totschnig.myexpenses.provider.TransactionDatabase.g(TransactionDatabase.java:4191)
    ... 21 more
mtotschnig commented 1 month ago

Thank you very much for the report and sorry for the inconvenience. This is fixed in upcoming version 3.9.0 (5265f38887ad65e06098ff8ea397c3ad4f530831)