How to deal with the repeated jar in Android Studio?

☆樱花仙子☆ 提交于 2020-01-17 02:42:27

问题


As shown in the figure,"xxx finished with non-zero exit value 2",some people say that is the repeated jars caused it.But I did not find the repeat jars yet.So,how can I deal with it?

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

App - 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 - Library - 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 - Library - 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 - Library - 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'

回答1:


Try this, In your code

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

If multidex is enabled.The gradle will neglect the duplicate dex files



来源:https://stackoverflow.com/questions/31199135/how-to-deal-with-the-repeated-jar-in-android-studio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!