I’ve added several dependencies in my Android project in IntelliJ, for unit-tests (JUnit4, JMock, SQLite-jdbc, etc.). I defined all of them as “test” scope in the module dependencies settings, so that they are used only when running my unt-tests and they don’t get in the way of the production code.
My problem is that when the .apk file is generated, it basically ignores the “test” scope setting, and includes all the unneeded dependencies, which boost the size of the .apk by a dozen MBs.
Is there a way to prevent this from happening?
Android tests can run on device, therefore test dependencies may be required to actually run them. If classes that you are using in the tests are already available on the device as a part of Android platform, you can try setting the scope to Provided.