2016-11-29 116 views
-1

我尝试使用selendroid运行该测试Android Studio中复制文件0.17.0.jar和selendroid-standalone-0.17.0 -with-dependencies.jar)在运行之前,我已经通过cmd启动了服务器。但是,每次运行时我都会收到此错误:在APK README.md Android Studio中复制项目

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. 
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK README.md 
    File1: C:\Users\Training\AndroidStudioProjects\Sample_Three\app\libs\selendroid-client-0.17.0.jar 
    File2: C:\Users\Training\AndroidStudioProjects\Sample_Three\app\libs\selendroid-standalone-0.17.0-with-dependencies.jar 

我还没有真正发现任何有关如何解决此问题的建议。我希望你们能帮忙。谢谢!

编辑:这是我的build.gradle文件:

apply plugin: 'com.android.application' 

android { 

packagingOptions { 
    exclude 'META-INF/DEPENDENCIES.txt' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/notice.txt' 
    exclude 'META-INF/license.txt' 
    exclude 'META-INF/dependencies.txt' 
    exclude 'META-INF/LGPL2.1' 
} 

compileSdkVersion 25 
buildToolsVersion "25.0.1" 
defaultConfig { 
    applicationId "com.example.training.sample_three" 
    minSdkVersion 15 
    targetSdkVersion 25 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    multiDexEnabled true 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 


} 

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',  { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:25.0.1' 
testCompile 'junit:junit:4.12' 
compile files('libs/selendroid-client-0.17.0.jar') 
compile files('libs/selendroid-standalone-0.17.0-with-dependencies.jar') 
} 
+1

*我还没有真正找到任何建议,网上关于如何解决它。* ...监守你没有甚至尝试过...我发现它与一个简单的谷歌查询...不,我不会提供答案,因为它不是人类搜索引擎 – Selvin

+0

我已经尝试了很多,但不幸的是,它创建了其他错误。谢谢你的提示。 – user2953186

+0

请注意,您的重复文件不在META-INF文件夹中。 '排除'README''应该修复它 –

回答

1

只需添加到您的build.gradle文件

packagingOptions { 
exclude 'META-INF/README'} 

packagingOptions { 
exclude 'README'} 

与上述两个选项试试。

请在这里发布任何问题之前做一些研究。您可以在Google上轻松获得这些问题的答案。

+0

我试过了,它不起作用。问题不在于META-INF,它在APK README.md中,这就是为什么我很难修复它 – user2953186

+0

将您的build.gradle文件粘贴到此处。所以我们可以看到究竟有什么。 –

+0

自述文件应该后面跟着.md(README.md) –