Conflict between Android and Guava data binding causes ProGuard error

I get the following error when compiling my Android application 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) 

This seems to be caused by a conflict between data binding and Guava. My application depends on Guava (com.google.guava: guava: 18.0) and has data binding. It appears that data binding has some kind of internal dependency on Guava, and this causes a problem with ProGuard.

I am running the latest gradle beta (2.0.0-beta5), so there may be a problem with this.

+6
source share
1 answer

So, I managed to build by adding this to proguard: -dontwarn android.databinding.** -keep class android.databinding.** { *; } -dontwarn android.databinding.** -keep class android.databinding.** { *; }

What I don’t think is the right decision to just ignore these classes, but I think we just have to wait for the update from Google. By adding this to proguard, I was able to create an apk release, but it failed, I thought it was still proguard, but found other errors in my code.

+11
source

All Articles