Nilzor
Nilzor

Reputation: 18593

Cannot run instrumentation tests after I introduced databinding

I'm getting

Warning: library class android.databinding.DataBindingUtil depends on program class android.databinding.DataBindingComponent

I get this when attempting to run the gradle task assembleItestAndroidTest after introducing data binding to my project. (I have a separate build config for instrumentation testing which I call itest, the other two being debug and release)

How to fix this?

edit: I think this is a android-gradle build tool bug or Android Data Binding bug. I've filed a bug report to Google with full instructions on how to reproduce.

The key here is that the build type is configured to run minification. So any build type other than debug for the instrumentation test will fail as long as you rely on data binding.

This is pretty much a show-stopper for any company having continous integration as an integral part of their production cycle so I hope Google prioritize this high.

Upvotes: 9

Views: 1315

Answers (1)

bpen42
bpen42

Reputation: 11

Try adding the following to your proguard config:

-dontwarn android.databinding.**
-keep class <whatever your package name in AndroidManifest is>.databinding.** {
    <fields>;
    <methods>;
}

The first line gets rid of the warning, and the second tells proguard to not mess with any of the generated classes.

Upvotes: 1

Related Questions