Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conflict between Android data binding and Guava causes ProGuard error

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.

like image 862
Jade Avatar asked Feb 18 '16 03:02

Jade


1 Answers

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.

like image 60
Brando Madden Avatar answered Sep 23 '22 00:09

Brando Madden