Android Release模式下无法运行一例解决方法

报错
···
FATAL EXCEPTION: main
Process: com.tools.xxxxx, PID: 10746
androidx.fragment.app.u: Subscriber class com.tools.xxxxx.ui.HomePageFragment and its super classes have no public methods with the @Subscribe annotation
at j4.d.i(Unknown Source:371)

···
由于我使用了EventBus,d打开proguard-rules.pro文件,添加内容
-keepattributes Annotation
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe ;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
正常。

posted @ 2024-07-22 09:55  zhaogaojian  阅读(11)  评论(0编辑  收藏  举报