public class AssetsHelper {
@StringDef({ScreenDensity.XHDPI,ScreenDensity.HDPI, ScreenDensity.XXHDPI})
@Retention(RetentionPolicy.SOURCE)
public @interface ScreenDensity {
String HDPI = "HDPI";
String XHDPI = "XHDPI";
String XXHDPI = "XXHDPI";
}
}
当我在android sdk的tools文件夹中使用默认pro-guard规则时,我得到了
ScreenDensity
的错误。什么是pro-guard规则来防止这个StringDef
ScreenDensity
被混淆? 最佳答案
尝试添加此Proguard规则:
-keepclassmembers class ** {
@your.package.AssetsHelper.ScreenDensity public *;
}