I have an Android Gradle 1.1 Project with several Modules that have some dependency on the others.
Project
├ Module2
│ ├ src/main: imports classes from Module1
│ └ src/test: imports classes from Module1, tests Module2/src/main
└ Module1
├ src/main: implements classes needed by Module2/src/main & Module2/src/test
└ src/test: tests Module1/src/main
My Modules themselves compile fine.
My question is related to testing the modules.
(FYI: I am using Robolectric)
I have seen several "similar" questions related to Android build & test dependencies, but none of the ones that I have found seem to be asking what I am looking for:
- Android Gradle 1.1 - adding a test dependency on another project's tests
- How to run unit tests with dependency to an Android library module?
- Gradle Android unit tests that depend on an 'aar'
- Multi-project test dependencies with gradle
- Jacoco and Unit Tests Code Coverage with android-gradle-plugin >= 1.1
- Android Studio module that depends on another module's tests
These questions are also either old, not focused on using Android Gradle 1.1+ built in Unit Test abilities, or not really that relevant.
What I am asking is: "How can a [java compiled?] unit test import another android module (normally a .aar file) in the same project?"
A "testCompile project(':module1')" doesn't seem to do the trick.
I suspect that I want to either:
- Compile the other module that I depend on as a .jar file
- Use the other module's already compiled .class files
- Extract the .class files from the other module's .aar file
- Find some other built in way to do this
Is there a slick way to do this built in to the Android/Gradle build process?
Am I missing something obvious here?
Thanks!
Pv