将powermock添加到android测试项目时,apkbuilder会找到重复的文件

Jea*_*ril 5 android unit-testing mockito powermock

我正在尝试将powermock-mockito和mockito添加到Android Test项目中.我使用android命令行工具创建了android测试项目来创建build.xml和项目结构.我的libs /目录中有以下jar:

  • dexmaker-1.0.jar
  • dexmaker-的Mockito-1.0.jar
  • 的Mockito-ALL-1.9.5.jar
  • powermock-的Mockito-1.5-full.jar

当我尝试使用ant debug构建项目时,出现以下错误:

[apkbuilder] Creating ProjectTests-debug-unaligned.apk and signing it with a debug key...
[apkbuilder] Found duplicate file for APK: mockito-extensions/org.mockito.plugins.MockMaker
[apkbuilder] Origin 1: /home/cmiller/Projects/android-project/ProjectTests/libs/powermock-mockito-1.5-full.jar
[apkbuilder] Origin 2: /home/cmiller/Projects/android-project/ProjectTests/libs/powermock-mockito-1.5-full.jar

BUILD FAILED
/home/cmiller/Applications/adt-bundle-linux/sdk/tools/ant/build.xml:951: The following error occurred while executing this line:
/home/cmiller/Applications/adt-bundle-linux/sdk/tools/ant/build.xml:962: The following error occurred while executing this line:
/home/cmiller/Applications/adt-bundle-linux/sdk/tools/ant/build.xml:319: com.android.sdklib.build.DuplicateFileException: Duplicate files at the same path inside the APK
Run Code Online (Sandbox Code Playgroud)

我不确定它是如何在一个罐子里找到一个重复的文件.build.xml文件根本没有被修改过,我还没有创建custom_rules.xml.任何帮助将不胜感激.

kol*_*aTM 2

你检查过jar文件中的文件是否真的重复吗?据我所知,同一个文件可以在一个 zip 文件中出现两次。在该文件中,将其从 jar 中删除可能会有所帮助。但不知道它会如何到达那里。