4

I'm using proguard for the first time with my android app.

I'm not getting it working correctly. I was looking at my usage.txt file to see what was the part's that proguard deleted from my code.

I see this unusual things and didn't know what to think:

 [my_package].Manifest
    [my_package].Manifest$permission
    [my_package].R$array
    [my_package].R$attr
    [my_package].R$bool
    [my_package].R$color
    [my_package].R$dimen
    [my_package].R$id
    [my_package].R$integer
    [my_package].R$layout
    [my_package].R$menu
    [my_package].R$raw
    [my_package].R$string
    [my_package].R$style
    [my_package].R$styleable

Is proguard deleting all this content from my code?

4

1 回答 1

3

将此添加到您的 proguard 配置中:

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

并查看此通用 android proguard 设置:Android:Proguard 的推荐配置是什么?

编辑:对于反射添加这个:

-keepattributes InnerClasses

-keep class **.R
-keep class **.R$* {
    <fields>;
}
于 2013-10-08T14:24:49.860 回答