Conflict between Android data binding and Guava causes ProGuard error

被刻印的时光 ゝ 提交于 2020-01-01 09:05:30

问题


I get the following error while compiling my Android app with ProGuard enabled.

Warning: library class android.databinding.tool.util.SourceCodeEscapers$1 
    extends or implements program class com.google.common.escape.CharEscaper
Warning: library class android.databinding.tool.util.SourceCodeEscapers$JavaCharEscaper 
    extends or implements program class com.google.common.escape.ArrayBasedCharEscaper
Warning: library class android.databinding.tool.util.SourceCodeEscapers$JavaCharEscaperWithOctal 
    extends or implements program class com.google.common.escape.ArrayBasedCharEscaper
Warning: there were 3 instances of library classes depending on program classes.
         You must avoid such dependencies, since the program classes will
         be processed, while the library classes will remain unchanged.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)

It appears that this is caused by a conflict between Android data binding and Guava. My app depends on Guava (com.google.guava:guava:18.0) and has data binding enabled. It appears that data binding has some sort of internal dependency on Guava and that is causing a problem with ProGuard.

I am running the latest beta version of gradle (2.0.0-beta5) so perhaps the problem is related to that.


回答1:


So I was able to Build by adding this to proguard: -dontwarn android.databinding.** -keep class android.databinding.** { *; }

Which I don't think is entirely the right solution to just ignore those classes but I think we might just have to wait for an update from Google. After adding that to proguard I was able to build a release apk but it was crashing, I thought it was still proguard but found other errors in my code.



来源:https://stackoverflow.com/questions/35472130/conflict-between-android-data-binding-and-guava-causes-proguard-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!