如何逐步混淆android库项目

时间:2014-02-17 10:28:06

标签: android android-library

我面临一个问题,从长期回到混淆android lib项目而不是Android应用程序, 我尝试使用android proguard GUI,但在混淆后我无法使用jar。

请向我提供步骤指南或此问题已修复的任何链接。

提前致谢..

1 个答案:

答案 0 :(得分:0)

将其保存为proconf.txt并使用proguard gui作为配置文件打开并更改输入和输出jar位置..并处理 如果需要,还可以更改andoid.jar的位置并支持lib。

-injars 'bishwash/eclipse kepler'
-outjars bishwash/

-libraryjars bishwash/android-sdk-macosx/platforms/android-18/android.jar
-libraryjars 'bishwash/eclipse kepler/android-work/uxcam_lib_new/libs/android-support-v4.jar'

-dontskipnonpubliclibraryclassmembers
-printmapping mapping.txt
-dontusemixedcaseclassnames
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keepparameternames
-renamesourcefileattribute SourceFile
-dontpreverify
-verbose


-keepclassmembers class * extends java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

# Keep - Library. Keep all public and protected classes, fields, and methods.
-keep public class * {
    public protected <fields>;
    public protected <methods>;
}

# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum  * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# Keep names - Native method names. Keep all native class/method names.
-keepclasseswithmembers,allowshrinking class * {
    native <methods>;
}

# Keep names - _class method names. Keep all .class method names. This may be
# useful for libraries that will be obfuscated again with different obfuscators.
-keepclassmembers,allowshrinking class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String,boolean);
}

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** e(...);
}