On gradle: 3.0.0, several files were found with an OS-independent path "META-INF / ASL2.0",

I upgraded my android studio to version 3.0 and then he asked me to upgrade to 'com.android.tools.build:gradle:3.0.0'

everything went well until I decided to start my project and it gave me this error

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

Several files were found with an OS-independent path "META-INF / ASL2.0"

My gradle app

   android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.test.demo"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}'

My gradle library

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_6
            targetCompatibility JavaVersion.VERSION_1_6
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }
}
+4
source share
1 answer

You must add build.gradleyour packagingOptions:

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
}
+8
source

Source: https://habr.com/ru/post/1688228/


All Articles