-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
大家如果遇到开启混淆后,奔溃的问题加上如下代码即可解决问题 #63
Comments
AGP 8.0,默认开启android.enableR8.fullMode,在fullMode下,就算配置了混淆规则也不行 @DylanCaiCoding 有空帮忙看看 |
遇到同样问题,AGP 8.0.1,即使配置了规则依然报错, @DylanCaiCoding 麻烦大佬看看 |
试试这个,我亲测好使 -keep class * implements androidx.viewbinding.ViewBinding {*;} -keepclassmembers class * implements androidx.viewbinding.ViewBinding { -keep,allowobfuscation,allowshrinking class 你的包名. BaseBindingActivity |
问题已解决,十分感谢! |
其实把R8的完整模式关了也无伤大雅 |
@ChawLoo 项目大了,对包体积有要求 |
奔溃代码:
`
class TestActivity : BaseViewBindingActivity() {
}
`
未奔溃代码:
`
class TestActivity : BaseViewBindingActivity() {
}
`
原因:
使用baseViewBind类的时候,如果未调用过getBinding()中的属性,在打release包时,编译器优化会优化掉泛型中的ViewBind类[因为在编译器看来该ViewBind中的类未被使用],导致找不到ViewBind类
解决办法:
-keep class * implements androidx.viewbinding.ViewBinding {*;}
The text was updated successfully, but these errors were encountered: