Android - 重复条目:android / support / v4 / database / DatabaseUtilsCompat.class?

时间:2016-11-05 06:49:48

标签: android android-support-library android-support-design

我的Gradle是:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "24.0.3"

    defaultConfig {
        applicationId "jim.mp.offline"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:support-v4:25.0.0'
    compile('com.android.support:appcompat-v7:25.0.0') {
        exclude module: 'support-v4'
    }
    compile files('libs/commons-io-2.4.jar')
    compile files('libs/osmdroid-android-4.1.jar')
    compile files('libs/slf4j-android-1.5.8.jar')

}

但是当我运行项目时,我说:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/database/DatabaseUtilsCompat.class

1 个答案:

答案 0 :(得分:0)

我的问题解决了:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "24.0.3"

    repositories {
        mavenCentral()
    }

    defaultConfig {
        applicationId "jim.mp.offline"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile ('com.android.support:multidex:1.0.1'){
        exclude module: 'support-v4'
    }
    compile 'com.android.support:support-v4:25.0.0'
    compile('com.android.support:appcompat-v7:25.0.0') {
        exclude module: 'support-v4'
    }
    compile('commons-io:commons-io:2.4') {
        exclude module: 'support-v4'
    }
    compile('org.slf4j:slf4j-android:1.7.10') {
        exclude module: 'support-v4'
    }
    compile('org.slf4j:slf4j-api:1.7.10') {
        exclude module: 'support-v4'
    }
    compile files('libs/osmdroid-android-4.1.jar')
}