本文介绍了混淆+牛刀/数据绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我目前使用Butterknife将视图注入我的代码中.我注意到使用minifyenabled时不会混淆类名,因为butterknife需要正确的类名来生成将进行绑定的代理类. (MainActivity.class-> MainActivity_ViewBinding.class)

I currently use Butterknife to inject views into my code.I noticed class names are not obsfucated when i use minifyenabled, since butterknife needs the correct class name to generate the proxy classes that will do the binding. (MainActivity.class -> MainActivity_ViewBinding.class)

我愿意切换到android studio中的新"数据绑定库.但是由于考虑到我的项目很大,因此需要做很多工作,这是我的问题:

I'm willing to switch to the "new" Data Binding Library in android studio. But since it's a lot of work considering my project is huge, here's my question:

  • 数据绑定库也不会混淆类吗?

  • Will the Data Binding Library also not obsfucate the classes?

从黄油刀切换会影响我的应用程序的性能/大小吗?

Will switching from butterknife affect performance/size of my app?

谢谢

推荐答案

与Butterknife不同,Data Binding不使用反射.这都是生成的代码.所以:

Unlike Butterknife, Data Binding does not use reflection. It's all generated code. So:

  • 类将混淆数据绑定.我发现这对于我从Butterknife切换的自己的应用程序是正确的.
  • 性能可能会稍微好一些,但我并不期望有太大的收获.我还没有进行基准测试.
  • 数据绑定库似乎没有引入任何其他库,因此从大小上讲,不必担心.不记得Butterknife有什么依赖关系,我想是有一些依赖关系的.数据绑定库本身添加了约60个类,而您实际上不会使用其中的大多数类.使用Proguard(或Android Shrinker)消除未使用的类和方法也可以最大程度地减少这种影响;不知道多少课Butterknife库引入的方法.此外,您的代码还会通过这两种方法生成类,但是它们对大小的影响不应该那么大.

这篇关于混淆+牛刀/数据绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 14:44