如何处理Android Studio中的重复jar



如图所示,"xxx以非零退出值2结束",有人说是重复的jar导致的。但我还没有找到重复的jar。那么,我该怎么处理呢?

http://i3.tietuku.com/10ec1b3775cbb850.png

应用程序-build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "com.myatejx.quicknote"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 4
        versionName "1.2.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
tasks.withType(JavaCompile) {
    options.encoding = "UTF-8"
}
dependencies {
    compile project(':SwipeMenuListView')
    compile project(':Ldrawer')
    compile project(':Snackbar')
}

SwipeMenuListView-库-build.gradle:

    apply plugin: 'com.android.library'
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = ['src']
                resources.srcDirs = ['src']
                aidl.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                res.srcDirs = ['res']
            }
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile files('libs/android-support-v4.jar')
}

Snackbar-图书馆-build.gradle:

    apply plugin: 'com.android.library'
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
tasks.withType(JavaCompile) {
    options.encoding = "UTF-8"
}
dependencies {
    compile 'com.android.support:recyclerview-v7:22.0.0'
    compile 'com.android.support:support-annotations:22.0.0'
}
apply from: 'maven-push.gradle'

Ldrawer-图书馆-build.gradle:

    apply plugin: 'com.android.library'
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
tasks.withType(JavaCompile) {
    options.encoding = "UTF-8"
}
dependencies {
    compile 'com.android.support:support-v4:22.0.0'
}
//apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'

试试这个,在您的代码中

 defaultConfig {
        applicationId "com.myatejx.quicknote"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 4
        versionName "1.2.0"
        multiDexEnabled true
    }

如果启用了multidex。gradle将忽略重复的dex文件

最新更新