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
Do you have this into your project/module gradle?
packagingOptions {
exclude 'fileNameYouWantToExclude'
}
In this way Androd will put just one file if duplicates are found
The only correct answer is PowerMockito does not support the Davik VM Android uses, it is meant for a standard JVM. So you can't use it with instrumented tests, only unit tests.
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'
}
}