9

In the official android documentation, it says add useLibrary for the various dependency.

screenshot

I realized as long as i have

testImplementation "androidx.test.ext:junit:1.1.0"

in my dependencies block, i can still run unit test without any useLibrary lines.

Having useLibrary lines or not does not seem to have any effect on being able to run unit/instrumentation test

Question: What is the purpose of useLibrary lines if i can still run unit/instrumentation tests without it.


This question is NOT a duplicate of What's the difference between principles of useLibrary and compile files('') in build.gradle?

because i am using testImplementation keyword instead of compile and my question is regarding testing which doesn't actually ship the dependencies with the application.

Weizhi
  • 1,027
  • 8
  • 22

0 Answers0