Android, ProGuard, and keepclasseswithmembernames

前端 未结 2 1971
一整个雨季
一整个雨季 2020-12-31 19:15

A common pattern in ProGuard configs for Android applications is to preserve custom View classes, since they are probably referenced only from layout XML instea

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-31 19:51

    When I first tried the integrated proguard with Ant, my app kept crashing with runtime errors on the clickhandlers. (I always set these in XML). I assumed I must be doing something wrong, couldn't work out what, so added the line

    -dontshrink
    

    at the top of the proguard.cfg.

    Maybe this isn't optimal but it stopped the run time errors!

    Addendum

    In fact I checked this by looking at usage.txt. The clickhandlers were listed in there before I added the dontshrink option, after I added it, usage.txt was empty as would be expected.

提交回复
热议问题