现象:
Android APP中,引入actionbarsherlock 开源库作为滑动菜单,调试运行没有问题,项目混淆打包后,程序运行异常退出,截获异常log为:
<span style="white-space:pre"> </span>java.lang.ExceptionInInitializerError at com.actionbarsherlock.app.SherlockFragmentActivity.getSherlock(Unknown Source) at com.actionbarsherlock.app.SherlockFragmentActivity.onTitleChanged(Unknown Source) at android.app.Activity.setTitle(Activity.java:4614) at android.app.Activity.setTitle(Activity.java:4628)
原因:
混淆打包依赖库,依赖库资源被破坏
解决:
添加如下混淆配置项:
-dontwarn com.actionbarsherlock.** -keep class com.baidu.** { *;} -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } -keepattributes *Annotation*
Android项目引入actionbarsherlock作为library后混淆之后的异常,布布扣,bubuko.com
时间: 2024-10-05 12:14:36