Skip to content

Crash on Android when using R8/Proguard #112

@benoitletondor

Description

@benoitletondor

So on Android, release build are minified by R8/Proguard, it means that the code gets minified.

As a library, you can provide a proguard consumer rule file which describe which methods shouldn't be minified so that the full path will be present at runtime.

It looks like it's missing from Powersync and it leads to a crash:

 runtime.cc:708] Pending exception java.lang.NoSuchMethodError: no non-static method "Lcom/powersync/DatabaseDriverFactory;.onTransactionCommit(Z)V"
                                                                                                    runtime.cc:708]   at void io.requery.android.database.sqlite.SQLiteConnection.nativeExecute(long, long) (SourceFile:-2)
                                                                                                    runtime.cc:708]   at void io.requery.android.database.sqlite.SQLiteConnection.execute(java.lang.String, java.lang.Object[], D1.d) (SourceFile:31)
                                                                                                    runtime.cc:708]   at void io.requery.android.database.sqlite.SQLiteSession.endTransactionUnchecked(D1.d, boolean) (SourceFile:63)
                                                                                                    runtime.cc:708]   at void io.requery.android.database.sqlite.SQLiteSession.endTransaction(D1.d) (SourceFile:5)
                                                                                                    runtime.cc:708]   at void io.requery.android.database.sqlite.SQLiteDatabase.endTransaction() (SourceFile:9)
                                                                                                    runtime.cc:708]   at io.requery.android.database.sqlite.SQLiteDatabase io.requery.android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(boolean) (SourceFile:199)
                                                                                                    runtime.cc:708]   at io.requery.android.database.sqlite.SQLiteDatabase io.requery.android.database.sqlite.SQLiteOpenHelper.getWritableDatabase() (SourceFile:3)
                                                                                                    runtime.cc:708]   at z2.a io.requery.android.database.sqlite.SQLiteOpenHelper.getWritableDatabase() (SourceFile:1)
                                                                                                    runtime.cc:708]   at java.lang.Object G.i.invoke() (SourceFile:201)
                                                                                                    runtime.cc:708]   at java.lang.Object B9.r.getValue() (SourceFile:21)
                                                                                                    runtime.cc:708]   at z2.a M4.l.c() (SourceFile:5)
                                                                                                    runtime.cc:708]   at java.lang.Object Z2.f.invoke() (SourceFile:5)
                                                                                                    runtime.cc:708]   at java.lang.Object M4.l.b(java.lang.Integer, P9.a, P9.k, P9.k) (SourceFile:17)
                                                                                                    runtime.cc:708]   at Y2.e M8.b.d(java.lang.Integer, java.lang.String, P9.k, int, P9.k) (SourceFile:29)
                                                                                                    runtime.cc:708]   at Y2.e g8.e.Q0(P9.k) (SourceFile:16)
                                                                                                    runtime.cc:708]   at java.util.List F5.F0.S0() (SourceFile:7)
                                                                                                    runtime.cc:708]   at void c8.u.<init>(M4.l, a3.h) (SourceFile:59)
2025-02-04 00:21:46.358 11912-11961 r.xxx         com.xxx.xxx     A  runtime.cc:708]   at java.lang.Object Sb.e.d(H9.c, android.content.Context, h3.k, j3.a, j3.f, java.lang.String, java.lang.String, boolean) (SourceFile:325)
                                                                                                    runtime.cc:708]   at java.lang.Object x3.b.a(H9.c, android.content.Context, h3.k, j3.a, j3.f, java.lang.String, java.lang.String, boolean) (SourceFile:79)
                                                                                                    runtime.cc:708]   at java.lang.Object G3.l1.invokeSuspend(java.lang.Object) (SourceFile:148)
                                                                                                    runtime.cc:708]   at void H9.a.resumeWith(java.lang.Object) (SourceFile:9)
                                                                                                    runtime.cc:708]   at void jb.O.run() (SourceFile:110)
                                                                                                    runtime.cc:708]   at void c3.A.run() (SourceFile:169)
                                                                                                    runtime.cc:708]   at void qb.j.run() (SourceFile:3)
                                                                                                    runtime.cc:708]   at void qb.a.run() (SourceFile:94)
                                                                                                    runtime.cc:708] 
2025-02-04 00:21:46.358 11912-11961 r.xxx         com.xxx.xxx     A  runtime.cc:716] JNI DETECTED ERROR IN APPLICATION: mid == null
                                                                                                    runtime.cc:716]     in call to CallVoidMethodV
                                                                                                    runtime.cc:716]     from void io.requery.android.database.sqlite.SQLiteConnection.nativeExecute(long, long)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions