0
我使用Android-Studio 2.2.2,並且第一次嘗試使用espresso進行測試。隨着連接的build.gradle我得到了這些錯誤消息:在APK中複製的重複文件junit/runner/smalllogo.gif
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK junit/runner/smalllogo.gif
File1: /home/christian/AndroidStudioProjects/PinMoney/app/libs/junit-4.12.jar
File2: /home/christian/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar
這裏是應用gradle這個:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.1.0'
android {
compileSdkVersion 25
buildToolsVersion "25"
defaultConfig {
applicationId "de.cokuss.chhe.pinmoney"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'LICENCE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile files('libs/junit-4.12.jar')
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.2') {
exclude group: 'com.android.support'
}
androidTestCompile ('com.android.support.test:runner:0.5') {
exclude group: 'com.android.support'
}
}
我已經發現了幾個「複製文件複製」的問題,而與不同的文件搜索,但始終。剛加入
packagingOptions {
exclude 'LICENCE.txt'
exclude 'smalllogo.gif' //added
}
沒有幫助。