Android数据绑定和Guava之间的冲突导致ProGuard错误 [英] Conflict between Android data binding and Guava causes ProGuard error

查看:98
本文介绍了Android数据绑定和Guava之间的冲突导致ProGuard错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在启用ProGuard的情况下编译Android应用时出现以下错误.

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)

这似乎是由于Android 数据绑定和番石榴.我的应用程序依赖于Guava(com.google.guava:guava:18.0),并启用了数据绑定. 似乎表明数据绑定对番石榴有某种内部依赖性这会导致ProGuard出现问题.

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.

我正在运行gradle的最新测试版(2.0.0-beta5),所以问题可能与此有关.

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

推荐答案

因此,我能够通过将其添加到proguard来进行构建: -dontwarn android.databinding.** -keep class android.databinding.** { *; }

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

我认为忽略这些类并不是完全正确的解决方案,但我认为我们可能只需要等待Google进行更新即可.在将其添加到proguard之后,我能够构建一个发行版apk,但是它崩溃了,我以为它仍然是proguard,但是在我的代码中发现了其他错误.

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.

这篇关于Android数据绑定和Guava之间的冲突导致ProGuard错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆