shwenzhang / AndResGuard

proguard resource for Android by wechat team
Apache License 2.0
8.49k stars 1.53k forks source link

不支持androidx.constraintlayout.widget.Group #353

Open zhangkai281 opened 5 years ago

zhangkai281 commented 5 years ago

Hi 在使用AndResGuard之前,已经打包混淆之后的release包,在使用中并没有发现任何问题,再接入了AndResGuard,使用打出的app-release_7zip_aligned_signed.apk包,发现代码中只要使用了androidx.constraintlayout.widget.Group来控制显示和隐藏的代码都无效,全部都显示出来,我的项目是MVVM架构的,如下代码: <androidx.constraintlayout.widget.Group android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="@{vm.flag ? View.VISIBLE:View.GONE}" app:constraint_referenced_ids="id集合"/>

项目中大量使用了androidx.constraintlayout.widget.Group,本想AndResGuard只会对资源文件进行混淆并不会影响除资源之外的。出现这个问题后,我也从多方面的找原因都没有找到问题所在。但从未使用AndResGuard的包是可以正常使用,使用了AndResGuard之后的包才出问题,因此判断还是AndResGuard的导致。不知道如何解决。

103king commented 4 years ago

的确有这个问题,我也遇到了这个问题;因为我们的app最后都用到了360加固进行加固,一开始我以为是因为用360加固的问题,后来发现不是360加固的问题,是用了andResguard的问题

Fover23 commented 4 years ago

我也遇到了这个问题,用的是support包下的控件 android.support.constraint.Group

尝试将group的id添加到whiteList也没起作用

FanDuiWuXiaoJiaBan commented 4 years ago

我也遇到了,找了好半天

103king commented 4 years ago

我也遇到了这个问题,用的是support包下的控件 android.support.constraint.Group

尝试将group的id添加到whiteList也没起作用 不是把Group的id添加到白名单,而是把Group中的每个组件的id都添加到白名单,也就是说Group中有几个组件,就需要添加几个组件的id到白名单

Fover23 commented 4 years ago

@103king 感谢,今天试了一下group工作正常

TellH commented 4 years ago

AndResguard会混淆id的name,需要手动配白名单来规避这个问题。 android/support/constraint/ConstraintHelper.java image

Leon406 commented 3 years ago

我最终还是确认是微信插件的问题的,暂时禁用

看了最新版本还是有问题, 只能手动加 id 白名单,可以用通配符

viyarda commented 3 years ago

<androidx.constraintlayout.widget.Group android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="@{vm.flag ? View.VISIBLE:View.GONE}" app:constraint_referenced_ids="id集合"/>

在gradle中添加 whiteList = [ "R.id.xx", "R.id.xxx", "R.id.xxxxx" ]