android - How to add build.gradle dependency for both local and instrumented tests in a single line? -


to add library dependecy both local , instrumented unit tests need add 2 lines of code build.gradle:

testcompile "org.mockito:mockito-core:${mockitoversion}" androidtestcompile "org.mockito:mockito-core:${mockitoversion}" 

is possible in single line?

i'm looking like:

bothtestcompile "org.mockito:mockito-core:${mockitoversion}" 

you can let configurations extend other configurations. code below creates new configuration, testcompile , androidtestcompile extend from. way, each dependency of new configuration dependency of these configurations.

configurations {     // create new configuration     bothtestcompile     // let both configurations extend 'bothtestcompile'     testcompile.extendsfrom(bothtestcompile)     androidtestcompile.extendsfrom(bothtestcompile) } 

now can use new configuration in dependencies closure did in example.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -