AndroidStudio/Gradle with powermock

midnight picture midnight · Aug 5, 2014 · Viewed 30.6k times · Source

I couldn't find any info on how to setup powermock with Android Studio/Gradle. Everything I've tried resulted in build exceptions.

Could anybody show a correct way to do it?

Thanks.

Answer

Bhargav picture Bhargav · Dec 2, 2015

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'