AndroidStudio/Gradle with powermock

后端 未结 7 1576
小鲜肉
小鲜肉 2020-12-29 01:28

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

7条回答
  •  长情又很酷
    2020-12-29 01:46

    If you want to use more recent versions of Mockito, you can use something like this, which is adapted from the mockito 2 Powermock docs. Do make sure you use the right version of PowerMock for the given version of Mockito.

    ...
    testCompile 'junit:junit:4.12'
    testCompile "org.mockito:mockito-core:2.4.0"
    testCompile 'org.powermock:powermock-module-junit4:1.7.0RC2',
                'org.powermock:powermock-api-mockito2:1.7.0RC2'
    

提交回复
热议问题