Hello,
I added SQLCipher to my project and it worked as intended while debugging but app always crash at startup in the release version with this exception java.lang.NoSuchFieldError: no "J" field "mNativeHandle" in class "Lnet/sqlcipher/database/SQLiteDatabase;" or its superclasses
I tried disabling proguard then running a release build and it worked fine (since that’s the only difference between a debug and a release build).
I also tried the solutions proposed by the community here including:
- adding these two lines in proguard rules
-keep,includedescriptorclasses class net.sqlcipher.** { *; }
-keep,includedescriptorclasses interface net.sqlcipher.** { *; }
but that didn’t work
- adding the whole proguard rules file mentioned here proguard rules file
and that also didn’t work
so I tried starting a new project with room and added SQLCipher to it and the release version worked. the only difference between my project and that new one is that mine is a multi-module one while the new sample had only the app module. To make sure this was the issue, I added a new module to that new project and indeed the release build crashed at startup in that case. I am using version 4.5.3. what am I missing here?
P.S: the change in proguard rules file was in 2 modules only (the app module and the module with room dependency)