有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java错误:任务执行失败,重复条目

我收到以下错误消息:

Error:Execution failed for task ':app:packageAllReleaseClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: 安卓/support/v4/print/PrintHelper$1.class

我的身材等级

apply plugin: 'com.安卓.application'

安卓 {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.doldurkazan.umutbahadir.sonolsun"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile ('com.安卓.support:appcompat-v7:22.0.0') {
        exclude module: 'support-v4'
    }
    compile files('libs/安卓-async-http-1.4.8.jar')
    compile files('libs/安卓-support-v4.jar')
    compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-安卓.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.安卓.support:appcompat-v7:23.1.1'
compile files('libs/ksoap2-安卓-assembly-2.4-jar-with-dependencies.jar')
}

让我知道如何解决这个问题


共 (4) 个答案

  1. # 1 楼答案

    希望这能奏效。。。。确保从libs文件夹中删除jar文件,因为它们会给您带来问题。现在它从maven获取最新版本

    apply plugin: 'com.android.application'
    
    
    
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
    
        defaultConfig {
            applicationId "com.doldurkazan.umutbahadir.sonolsun"
            minSdkVersion 15
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        dependencies {
            compile fileTree(include: ['*.jar'], dir: 'libs')
            compile 'com.android.support:appcompat-v7:23.4.0'
            compile "com.android.support:support-v4:23.4.0"
            compile 'com.loopj.android:android-async-http:1.4.9'
            compile group: 'com.nostra13.universalimageloader', name: 'universal-image-loader', version: '1.9.5'
            compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.0'
            testCompile 'junit:junit:4.12'
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
            repositories {
                maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
            }
        }
    }
    
  2. # 2 楼答案

    你为什么这么做

    compile files('libs/android-support-v4.jar')
    

    而不是像添加appcompat一样包含v4支持库???这是产生错误的保证方法

  3. # 3 楼答案

    试着去掉这个

    compile ('com.android.support:appcompat-v7:22.0.0') {
        exclude module: 'support-v4'
    }
    

    编写代码并清理项目。这可能会有帮助

  4. # 4 楼答案

    试试这个

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
    
        defaultConfig {
            applicationId "com.doldurkazan.umutbahadir.sonolsun"
            minSdkVersion 15
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        dependencies {
            compile fileTree(include: ['*.jar'], dir: 'libs')
            compile 'com.android.support:appcompat-v7:23.1.1'
            compile files('libs/android-async-http-1.4.8.jar')
            compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
            compile fileTree(include: ['*.jar'], dir: 'libs')
    
    
            compile files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar')
            testCompile 'junit:junit:4.12'
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    

    您可能需要,也可能不需要添加

    compile "com.android.support:support-v4:23.1.1"
    

    使用中的支持库的所有版本都需要匹配,因此可以在同一个项目中混合使用v23和v22