In my Android app, I wanted to try to minify the apk because it would reduce the size of the deployable and it would make it slightly harder for other people to read the code and understand how it worked. For some of the external libraries I used, they gave instructions on what to add to the Proguard file, which was pretty helpful. However, I also used the Android Couchbase Lite 1.4 library. There were no Proguard instructions for this version of the library – there were instructions for Android Couchbase Lite 2.0, but when I tried those, the deployable still crashed when running. After searching the web for a while, I discovered something that helped. I added a few lines to the Proguard file to keep some libraries and it turned out to work.
-keep class com.fasterxml.jackson.core.** { *; }
-keep interface com.fasterxml.jackson.core.** { *; }
-keep class com.fasterxml.jackson.databind.** { *; }
-keep interface com.fasterxml.jackson.databind.** { *; }
-keep class com.fasterxml.jackson.annotation.** { ; }
-keep interface com.fasterxml.jackson.annotation.* { ; } -keep class com.couchbase.lite.** { *; }
-keep interface com.couchbase.lite.** { *; }
After adding these lines, I was able to run the built minified apk on my phone without any problems. After uploading the apk to the Google Play developer console, I noticed that there were a lot of warnings saying that the apk was using non-SDK interfaces (https://developer.android.com/distribute/best-practices/develop/restrictions-non-sdk-interfaces). I didn’t receive that warning in the build I uploaded that wasn’t minified, so I assumed that it must’ve been because it was minified. I’m not sure if I am going to push the minified apk out to the production Google Play store because I don’t want the app to potentially crash for users. However at the very least, Android Couchbase Lite 1.4 is able to be minified.