我正在构建一个android库,我使用的是一个实用程序类,其中所有方法都是静态的 . 此类在内部使用,不应由库用户使用 . 我正在使用proguard来混淆代码,我不想暴露实用程序类 . 当我使用proguard时,它会保留类名,并对其中的方法进行模糊处理 . 我没有用-keep特别排除那个 class .

这是我的proguard配置的通用部分

-keepparameternames
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,EnclosingMethod,MethodParameters,LocalVariableTable,LocalVariableTypeTable

//Preserve all annotations.

-keepattributes *Annotation*

// Preserve all .class method names.

-keepclassmembernames class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

// Preserve all native method names and the names of their classes.

-keepclasseswithmembernames class * {
    native <methods>;
}

// Preserve the special static methods that are required in all enumeration classes.

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

// Explicitly preserve all serialization members. The Serializable interface
// is only a marker interface, so it wouldn't save them.
// You can comment this out if your library doesn't use serialization.
// If your code contains serializable classes that have to be backward
// compatible, please refer to the manual.

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    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();
}

编辑:“-whyareyoukeeping”说我从另一个类(扩展服务)调用实用程序类中的方法,该类被排除在混淆之外 .