AndroidStudio /摇篮与powermock摇篮、AndroidStudio、powermock

2023-09-09 21:11:38 作者:挽手叙旧

我找不到如何设置powermock与Android工作室/摇篮任何信息。我用尽了一切导致在建例外。

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?

感谢。

推荐答案

林张贴,以帮助未来的读者,你需要在AS添加这些依赖关系powermock

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

testCompile 'junit:junit:4.12'
testCompile 'org.powermock:powermock-api-mockito:1.6.1'
testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.6.1'
testCompile 'org.powermock:powermock-module-junit4-rule:1.6.1'
testCompile 'org.powermock:powermock-module-junit4:1.6.1'