I'm working on a modular Android app where I have a base :app module and multiple dependent modules.
The :app module contains some shared business logic and models, including a DisplayItem model that gets displayed differently in each module (different sections of the UI).
All of this works fine, until I run my Unit tests in my module via the command line. When I run my tests via the Gradle wrapper, the tests in my modules fail with a ClassNotFoundException when trying to load the DisplayItem class in my tests.
com.me.news.NewsViewModelTest > initializationError FAILED
java.lang.NoClassDefFoundError
Caused by: java.lang.ClassNotFoundException
What I can't understand is why these tests run fine in Android Studio, and everything is compiling and resolving as expected, but then they fail when run from the command line. I suspect Android Studio is doing something to get these classes at runtime that isn't happening with the Gradle wrapper alone, but I can't figure out what.
Any thoughts about what is causing this error, what Android Studio may be doing, and how I could troubleshoot my Gradle build/project to fix these issues?
