Is this a library project? For library project, the code of the library is packaged with the code of the test in a single apk, so you cannot have the same class twice.
For app project, when loading the test apk, the Android runtime will complain if it finds the same class in both the tested app and the test app so you cannot do that either. On Wed, Apr 23, 2014 at 8:33 PM, Kaushik Gopal <[email protected]> wrote: > I'm using gradle for my android build process. Is it possible to have a > specific version of a class in the androidTest folder, for the test > environment alone? > > I know you cannot have classes at a different build levels i.e. we cannot > have the same class across a "buildType" (debug/release), > "productFlavor"(flavor1, flavor2, default) or "source > set"(main/androidTest) so: > > - debug + flavor1 = not allowed > - flavor1 + main = not allowed > - main + debug = not allowed > > - flavor1 + flavor2 = allowed > - debug + release = allowed > > so my expectation would be that > > - main + androidTest = allowed (because they are at the same build level > i.e. source set) > > But this does not seem to be the case. I get a duplicate class file. Can > someone let me know of a way to achieve this? > > *My reasoning as to why I would want this is because, for testing alone i > want to inject mock modules, based on a strategy recommended here > <http://stackoverflow.com/questions/23233362/getting-dagger-to-inject-mock-objects-when-doing-espresso-functional-testing-for>.* > > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Xavier Ducrohet Android SDK Tech Lead Google Inc. http://developer.android.com | http://tools.android.com Please do not send me questions directly. Thanks! -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
