Using PowerMock and Mockito in an Android Instrumentation test - Error - Duplicate files - org.mockito.plugins.MockMaker

后端 未结 3 2294
不知归路
不知归路 2021-02-20 11:29

I”m trying to use PowerMock to mock a class with a static method, but specifically I wish to do this within an Android Instrumentation test. To be clear I wish to run the test o

3条回答
  •  臣服心动
    2021-02-20 12:06

    I was able to workaround this issue with the following. If you see any error message that says Duplicate files copied in APK [filename], add that [filename] to be excluded in the packagingOptions.

    android {
        packagingOptions {
            exclude 'mockito-extensions/org.mockito.plugins.MockMaker'
        }
    }
    

提交回复
热议问题