Sqlcipher library is adding 6mb to apk size!

Sqlcipher library is adding 6mb to apk size !

For sake of encryption, 6mb is not acceptable for a user. any progard rules to add ? i have added this. no help!
-keep class net.sqlcipher.** { *; }

How much of size does sqlcipher library add to apk size ? How can i reduce the size ?

@srinivas3120 as @developernotes mentioned on the Github ticket you opened, here isn’t a simple way to reduce the size. You can consider removing native platforms to reduce the number of binary objects that have to be included with the APK (e.g. remove x86, since libhoudini should allow the arm binaries to be used). For example, if you are manually packaging SQLCipher, only include the armeabi and armeabi-v7a folders and binaries. Or, if you are using gradel, include an abiFilter in the gradle configuration, e.g.

ndk {
    abiFilters "armeabi", "armeabi-v7a"
}

If that doesn’t reduce the size enough you will need to reconsider using SQLCipher to provide your application with local data encryption.

Generally, How much of size does sqlcipher library add to apk size ? I am using gradle
compile 'net.zetetic:android-database-sqlcipher:3.5.4@aar'

@srinivas3120 ~5 or ~6 MB sounds about right. The native arm libraries are in the neighborhood of 1.25 MB each. The native x86 lib is 2.2 MB.

what are cons of removing x86 lib?
Is it guaranteed “libhoudini should allow the arm binaries to be used” after removing x86 lib

Hi @srinivas3120

libhoudini is a translation library which is not provided by Zetetic, so we cannot provide a guarantee that it will work on every device. You will have to decide whether the additional size required for SQLCipher on Android is appropriate for your application.

The spike in APK size is still relevant today for an app having 21 as minSdk? it adds ~1.5MB to 2MB on android bundle. Any possible way to reduce it?

Most current x86 devices ship a compatibility mode, libhoudini. However, there is no guarantee that this compatibility mode is available. Is there any way to check for libhoudini availability on a device in Java code?

Hi @Anjal_Saneen

While you may be able to check for libhoudini, that would occur at runtime and your APK would already be built. If you need to decrease the size, consider the abiFilters referenced above.