A test project to reproduce the issue would be great. Thanks! On Fri, Feb 6, 2015 at 8:32 AM, Greg Macdonald <[email protected]> wrote:
> The classes in lib1 - as if the library was not actually included in the > apk - which I should have checked explicitly. I'll create an example > project to share this weekend to demonstrate the case; may prove > informative anyway. > > thanks, > greg > > On Thursday, February 5, 2015 at 5:36:26 PM UTC-8, Xavier Ducrohet wrote: >> >> It's not clear to me what the problem is. Can you say more about what >> becomes broken when you add the androidTestCompile? >> >> What exact classdef error are you getting? On which class is that error >> (where is it coming from?) >> >> On Tue, Feb 3, 2015 at 6:11 PM, Greg Macdonald <[email protected]> wrote: >> >>> Given a multi-module project with compile dependencies of the main app >>> on subprojects, adding a androidTestCompile breaks dependencies on other >>> subprojects. >>> >>> Given app:build.gradel >>> >>> dependencies { >>> compile project(':lib1') >>> androidTestCompile project(':testfixture') >>> } >>> >>> The presence of the androidTestCompile dependency breaks the dependency >>> on lib1. The project builds, but we get runtime classdef errors for >>> classes in lib1. It seemed logical I could overcome this by explicitly >>> adding an androidTestCompile dependency for lib1, and this does compile and >>> run; however this is broken because production and test code get different >>> values for resource ID's. For example, R.raw.thing resolves to a different >>> value in production code than in test code. I assume this has to do with >>> resource merging and maybe we're getting the wrong build of lib1 somehow. >>> So, I tried using this syntax which I found in the android doc: >>> >>> androidTestCompile project(path: ':lib1', configuration: 'debug') >>> >>> But, of course you probably know that this gives the error that the >>> configuration is not found. I found the configuration values running >>> gradlew properties on the lib1 project and tried _debugTestCompile, >>> debugTestCompile and :lib1:_debugTestCompile; all were also not recognized. >>> I tried grepping thru the build directory for hints but I merely got older >>> with no new wisdom. >>> >>> I'm new to gradle and Android dev so I could be just using things wrong, >>> but I'm pretty sure this is a bug, or two. >>> >>> BTW, my driving need is for a subproject that is only included in >>> androidTest builds - this for code and to solve the problem of test-only >>> assets or resources. Yes, I found the technique in >>> https://code.google.com/p/android/issues/detail?id=64887 but it >>> basically copies assets to the production build which gives us an >>> unreliable build environment that has to be man-handled a bit to know what >>> you are actually shipping. This was very undesirable and it didn't work >>> reliably anyway. >>> >>> If you share a workaround, please be complete in your explanation of how >>> to use your suggestion - which I would love to hear. >>> >>> -- >>> 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. > -- 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.
