Your project has set `android.useAndroidX=true` but configuration `debugRuntimeClasspath` still contains legacy support libraries
Asked Answered
T

5

24

I am getting an warning in android studio when I run my app. the warning is- Your project has set android.useAndroidX=true, but configuration debugRuntimeClasspath still contains legacy support libraries, which may cause runtime issues. And a error- Manifest merger failed with multiple errors, see logs I checked my manifest file and there is no error in my manifest file. I tried debugging the app but it still doesn't fix. I am getting this after updating android studio from android studio arctic fox to android studio bumble bee which is recently released. I updated the gradle version tried cleaning project, invalidating caches but nothing worked. I increased the memory heap size and enabled multidex but still it is not fixed. Please help me out.

Taluk answered 9/2, 2022 at 5:43 Comment(1)
Please review your project dependencies if they contain legacy librariesAlexaalexander
D
29
  1. Comment this line in settings.gradle
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  1. Add this in build.gradle (project level):
allprojects {
   repositories {
       google()
       jcenter()
       maven { url "https://jitpack.io" }
   }
}
  1. Add in gradle.properties:
android.enableJetifier=true
android.useAndroidX=true
Dmz answered 22/2, 2022 at 9:23 Comment(5)
still not working have any other solution??Deem
For me, It worked with the line "android.enableJetifier=true" and by setting maven { url "jitpack.io" } in settings.gradle file.Kristlekristo
jcenter() is shot down since February 1, 2022 and can no longer be used.Exterminatory
Why do we need Jitpack.io here?Lanam
I did same things without using maven { url "https://jitpack.io" } and it solved my problemLoop
H
21

Add these in gradle.properties:

android.enableJetifier=true
android.useAndroidX=true

Sync your gradle and Run the app. It worked fine for me and I didn't have to do the changes in setting.gradle and build.gradle (Project level) or any other files.

Hotshot answered 9/7, 2022 at 7:28 Comment(1)
This worked fine and No needed to change anywhere else.Pincers
O
2

My solution is simialar to @JJ Smith one. But I didn't do anything to build.gradle file. So:

  1. Comment this line in setting.gradle:
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  1. Make sure you have these 2 lines in gradle.properties (if not add them or change them to true):
android.enableJetifier=true
android.useAndroidX=true
  1. Sync gradle

I DID NOT change the build.gradle(at project level) file. I report it here just for the sake of completeness:

buildscript {
    repositories {
        google()
    }
    dependencies {
        //...
    }
}


plugins {
    id 'com.android.application' version '7.2.0' apply false
    id 'com.android.library' version '7.2.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Operable answered 10/5, 2022 at 13:24 Comment(0)
B
2

Check if you the following dependency:

implementation 'com.android.support:multidex:1.0.3'

If you have it, just remove it. It worked for me.

Buckingham answered 23/9, 2022 at 10:48 Comment(0)
G
0

Similar to Damien

Comment the line

repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)

and add

android.enableJetifier=true 
android.useAndroidX=true
Gogol answered 4/1 at 22:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.