AndroidStudio/Gradle with powermock

Solution 1:

I'm posting in order to help future readers, you need to add these dependencies for powermock in AS

testImplementation 'junit:junit:4.12'
testImplementation 'org.powermock:powermock-api-mockito:1.6.2'
testImplementation 'org.powermock:powermock-module-junit4-rule-agent:1.6.2'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.2'
testImplementation 'org.powermock:powermock-module-junit4:1.6.2'

Solution 2:

Add the following lines to your dependencies{} block:

testCompile 'junit:junit:4.12'
testCompile 'org.powermock:powermock:1.6.5'
testCompile 'org.powermock:powermock-module-junit4:1.6.5'

And if you would like to use PowerMockito, add the following line:

testCompile 'org.powermock:powermock-api-mockito:1.6.5'