Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
ProGuard with SQLCipher for Android
-libraryjars libs/commons-codec.jar
-libraryjars libs/guava-r09.jar
-libraryjars libs/sqlcipher.jar
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-dontobfuscate
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-dontwarn javax.annotation.**
-dontwarn android.app.**
-dontwarn android.support.**
-dontwarn android.view.**
-dontwarn android.widget.**
-dontwarn com.google.common.primitives.**
-dontwarn **CompatHoneycomb
-dontwarn **CompatHoneycombMR2
-dontwarn **CompatCreatorHoneycombMR2
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
-keep public class net.sqlcipher.** {
*;
}
-keep public class net.sqlcipher.database.** {
*;
}

10 -dontobfuscate?

Is this a must? Then we can't obfuscate the whole project because of sqlcipher? Then proguard lose most of its meaning!

Owner

developernotes commented Aug 19, 2014

Hi @DongChengliang

No, that is not required, however ProGuard does provide other useful features such as file shrinking and optimization. I will remove the -dontobfuscate option when I include this with SQLCipher for Android to remove any confusion.

I just spend a few hours making this work.
This:
-keep public class net.sqlcipher.** { ; }
-keep public class net.sqlcipher.database.
* { *; }

needs to be:
-keep class net.sqlcipher.** { ; }
-keep class net.sqlcipher.database.
* { *; }

Remove that 'public' keyword!!!!!

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

The above already includes:
-keep class net.sqlcipher.database.** { *; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment