[gradle] Exclude dependency for flavor

954 views
Skip to first unread message

Artem Zinnatullin

unread,
Nov 27, 2014, 2:33:16 PM11/27/14
to adt...@googlegroups.com
Hello everybody.

I have pretty non-standard problem:

App has library as sub-project in dependencies with native part which is compiled only for arm (Yandex Map Kit), no x86 version :(
We have some tests (based on UiAutomator) which we need to execute on the CI.

The problem is that we want to use x86 emulators for testing (performance) and I need to exclude this sub-project for one special "autoTestFlavor" and mock it.

Does anybody know how to remove sub-project from dependencies for one of the flavors?

Jake Wharton

unread,
Nov 27, 2014, 2:50:44 PM11/27/14
to adt...@googlegroups.com

Why not just use a flavor-specific dependency on the ones where you do want it?

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Artem Zinnatullin

unread,
Nov 27, 2014, 3:16:17 PM11/27/14
to adt...@googlegroups.com
Hi Jake, thank you for suggestion, seems good. I only thought about excluding dependency, not about flavor-specific including.

I'll try it.

Btw, what do you think about UiAutomator? 

As I understand, Square uses Espresso (2x), but it's based on Instrumentation, and tests coupled with Application code too closely, it's a White Box which is bad for Functional testing, I often saw instrumental tests with "hacks" around the views, fragments and so on, users don't look inside the app when they use it :)

UiAutomator makes you write tests almost as users would interact with the app + it's system-wide, not only for application process

Artem Zinnatullin

unread,
Nov 27, 2014, 3:36:39 PM11/27/14
to adt...@googlegroups.com
Works good, for those who want to solve same problem — use productFlavorNameCompile instead of general compile.

The only problem with this solution: if you have several flavors which requires dependency, you'll have to declare "compile" for each of these flavors, looks ugly when you need just want to exclude dependency from one of the flavors.

Jake Wharton

unread,
Nov 28, 2014, 9:18:13 PM11/28/14
to adt...@googlegroups.com
UiAutomator is fine, but I have no use for it. Instrumentation testing is only as white box as you make it.
Reply all
Reply to author
Forward
0 new messages