Hi everyone,--I'm having trouble using Android, Mockito and Powermock. In a nutshell I wish to mock a static method, for an Android Instrumentation test (to be ran on the device). When gradle tries to build the test apk (when running an Android instrumentation test) I get this error:com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK mockito-extensions/org.mockito.plugins.MockMaker
File1: /Users/kaiarmer/.gradle/caches/modules-2/files-2.1/com.crittercism.dexmaker/dexmaker-mockito/1.4/70892a94894462c1b35df3c8a77d21b7e843550b/dexmaker-mockito-1.4.jar
File2: /Users/kaiarmer/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-api-mockito/1.6.4/fe12509b7e9e49d25131f4155145748a31e42e40/powermock-api-mockito-1.6.4.jarI've tried a lot of things to resolve this and I've published a comprehensive stack overflow post. I'd be grateful to anyone who could have a look and see if they could shed any light please:Thanks in advanceKai
You received this message because you are subscribed to the Google Groups "PowerMock" group.
To unsubscribe from this group and stop receiving emails from it, send an email to powermock+...@googlegroups.com.
To post to this group, send email to powe...@googlegroups.com.
Visit this group at https://groups.google.com/group/powermock.
For more options, visit https://groups.google.com/d/optout.
Hi Johan,Thanks for the reply.An instrumentation test (in the Android world) is a test that runs on a device (or emulator) and interacts with the Android framework, rather than say just testing a stand-alone java utility class, which conversely could be done on the jvm.My understanding is that some others have managed to get this to work with the Android framework by removing the duplicates from the offending jars manually (or using Maven's 'ignore duplicates' feature) and using the dexmaker libraries to convert to dex. The libraries in question are:androidTestCompile 'com.crittercism.dexmaker:dexmaker:1.4' androidTestCompile 'com.crittercism.dexmaker:dexmaker-mockito:1.4'Thanks.Kai.
Hi Johan,I'm still trying to get this working - think I have gotten a little further as it seems to be trying to dex the classes up but failing due to multiple versions of a class from the dependency jars. I've pushed up a commit to include this work (within my test app). I'll keep going (in my spare time) and of course I'm happy to contribute if I can.Thanks,Kai
packagingOptions {
exclude 'nameOfTheFileCausingProblem'
}java.lang.IllegalStateException: Extension API internal error: org.powermock.api.extension.proxyframework.ProxyFrameworkImpl could not be located in classpath.