Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 1.53 KB

AndroidMinify.md

File metadata and controls

36 lines (28 loc) · 1.53 KB


Minified builds on Android

@capacitor-community/sqlite

You may want to enable minification for your Android production builds. This is possible by default in Capacitor, but requires some modifications to work with SQLite.

In general, you can enable minification for your release build type by modifying your gradle file.

android {
  //
  buildTypes {
    release {
      minifyEnabled true // <- enable it here
      shrinkResources true // <- optional
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 
      'proguard-rules.pro' // <- configuration file
    }
  }
}

Now you need to modify the proguard configuration file. You will find your proguard file here: android/app/proguard-rules.pro. This will configure how Gradle compiles your application. Proguard files act like a CLI append, you just put flags in there.

-keep class net.sqlcipher.** { *; }
-keepclassmembers class net.sqlcipher.** { *; }

This will exclude minification of all SQLCipher classes and class-members so Capacitor Community SQLite does not error on minified function names.

Read more about that topic here: