如何使用Proguard使用SQLCipher(使用-obfuscate)来混淆我的android项目?

时间:2014-02-25 08:08:03

标签: android obfuscation proguard sqlcipher

我有一个Android项目使用SQLCipher。我想用proguard来混淆它。它在使用-dontobfuscate时有效。否则我收到错误:sqlCipher的NoClassDefFoundError。但我想混淆。我的conf现在包含-dontobfuscate个关键字。它有效,但它不使用混淆。我怎样才能做到这一点 ?

谢谢大家的帮助......

- 这是我的conf:

-injars      bin/classes
-injars      libs
-outjars     bin/classes-processed.jar

-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizationpasses 5
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keepattributes *Annotation*

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-verbose
-dontpreverify   

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


-keep class javax.**  { *; }
-keep class org.**  { *; }
-keep class twitter4j.**  { *; }
-keep class java.lang.management.**  { *; }
-keep class com.google.code.**  { *; }
-keep class oauth.signpost.**  { *; }


-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider

-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keep public class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

-keep public class * extends android.app.Fragment
-keep public class * extends android.support.v4.Fragment

-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.content.Context {
   public void *(android.view.View);
   public void *(android.view.MenuItem);
}

-keepclassmembers class * implements android.os.Parcelable {
    static ** CREATOR;
}

-keepclassmembers class **.R$* {
    public static <fields>;
}

-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

-keepclassmembers enum * {
    public static **[] values();
      public static ** valueOf(java.lang.String);
  }


-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-dontwarn android.support.**
-dontwarn **CompatHoneycomb

* EDITED: 它的工作原理是删除public *

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

1 个答案:

答案 0 :(得分:0)

语法是

-keep class

你不应该keep public