I have the following Project Structure:
Main App
--app
--featureModule1
--featureModule2
--TestKit(Library module)
where Testkit has all dependencies including app and featureModules. The Testkit included all the unit tests related to the features in app and featuremodules.
When i run unit tests from Android studio(Right click-> Run Test in Testkit), they run fine. However whenever i try running it from gradle command: ./gradlew TestKit:testInternalDebugUnitTest
, it throws NoClassDefFoundError
for all the dependencies of other modules(for both app and feature modules).
Also i have already added implementation and testImplementation dependencies of all the modules in test module.
Please suggest:
Do i need to add path of classes generated in other modules, if yes pls guide where.
Also running Test with Coverage fails with
java.lang.VerifyError: Bad return type
Please suggest what am i doing wrong here.
Note: I have created a Testkit because of the multiple open issues of Roboelectric in feature modules for ex: https://github.com/robolectric/robolectric/issues/5428
Versions AS: 4.0.1 gradle: 4.0.1 gradle-wrapper: 6.5 Robolectric: 4.3.1