android:onClick not working with ProGuard

前端 未结 2 1751
独厮守ぢ
独厮守ぢ 2021-01-03 03:08

Since today, something weird is happening with my application. Every time I click a button that has set the android:onClick attribute, I get an IllegalStateException: Co

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 03:58

    You need to tell proguard not to mutate the method associated with your android:onClick tag.

    Here is an example rule (taken from the proguard website):

    -keep class mypackage.MyCallbackClass {
        void myCallbackMethod(java.lang.String);
    }
    

提交回复
热议问题