I am trying to structure my project so that I can run EUnit tests against my code. I have 3 projects in the solution:
- Android Application project
- EUnit Test project
- Shared project
Any code that I want to run EUnit tests against is in the Shared project, and the Shared project is added as a reference to the Android App and EUnit Test projects. This appears to work fine until I add a dependency on a Gradle reference to my shared project. For example, in the sample project below, my Shared project has a class that extends the AndroidX library’s Fragment class. The AndroidX library (androidx.appcompat) is added as a Gradle reference to both my Android App project and my EUnit Test project, so it compiles without issue. The Android App project runs fine, but the EUnit Test project crashes at startup with error
It seems that the AndroidX Fragment is not actually being packaged into the APK even though it is added as a Gradle reference? Here’s the sample project.
TodoApp.zip (65.4 KB)