nvko
nvko

Reputation: 93

More than one file was found with OS independent path 'META-INF/androidx.legacy_legacy-support-core-utils.version'

I added BottomNavigationView and then things started to complicate. I don't know what's causing this error, when I build project it's okay but then when I want to play app in emulator - this error pops up.

Here is my build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.pokrz.x"
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    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'
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.parse:parse-android:1.16.3'
    implementation 'com.google.android.material:material:1.0.0-beta01'
}

repositories {
    mavenCentral()
}

I don't know what else I can do. I'm sooooo done with it.

Upvotes: 8

Views: 11328

Answers (6)

Muji Tech
Muji Tech

Reputation: 21

Two ways to solve it

1- first

  • . Click on Specific project in android Studio

    . Build 
    . Clean Project 
    . Run again
    . Click **file**->**Invalidate Caches** /Restart
    

2- Second

Go to android project's in any disc you can store apps

  • Delete bothe folder ->debug ->release

Upvotes: 0

Abdul Waheed
Abdul Waheed

Reputation: 4678

Today, I was having the same problem. Below solution did not work for me

  1. Clean the project
  2. Invalidate case and restart

I solved that by deleting the folder. If you are facing this problem via creating release build then delete release folder and if you are facing this problem via creating debug build then delete debug folder. And now you are good to go. Now you can create signed APK. It may help others. enter image description here

Upvotes: 0

Dhaivat Rawal
Dhaivat Rawal

Reputation: 11

Actually the same Error Was happenimg with me also ... and By just Re-Starting my Android Studio it solved....

Upvotes: 1

Tabs
Tabs

Reputation: 11

This message appears when upgrading Android Studio and has to do with Gradle Plugin Version and Gradle Version. I've seen the error with:

  • Android Gradle Plugin Version 3.6.2
  • Gradle Version 6.3
  • Build: Generate APK Debug

However, build was OK when generating the APK Release. More importantly, it was OK too by switching the Android Gradle Plugin Version to 3.5.0, 3.6.0, 3.6.1... and then rebuilding. Finally, it worked again well with 3.6.2 (latest version as of this writing) after switching once or twice the plugin version.

So, just play with it until you reach a combination that works. Further, try back the latest plugin version, as it seems to be just a bug of Android Studio when upgrading.

(Conclusion: No need to add 100 exclude statements in your build.gradle)

Upvotes: 1

Dmitry Isaev
Dmitry Isaev

Reputation: 3998

Build > Clean Project helped me.

Upvotes: 29

Abdul-Hamid Kpetre
Abdul-Hamid Kpetre

Reputation: 114

Add a new exclude line with the path that is causing the error : exclude 'META-INF/androidx.legacy_legacy-support-core-utils.version'

Upvotes: 6

Related Questions