8

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.

Jade
  • 3,156
  • 1
  • 34
  • 44

1 Answers1

13

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.

Massimo
  • 3,436
  • 4
  • 40
  • 68
Brando Madden
  • 346
  • 3
  • 8
  • 2
    I was able to get away with just adding `-dontwarn android.databinding.tool.util.**` to my ProGuard file. – Jade Feb 25 '16 at 15:39