1

I am getting a problem when I try to add a dependency in Android Studio. I want to add com.android.support:design:28.0.0 to dependencies, but I am getting an error like this:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
}

ERROR: Manifest merger failed with multiple errors, see logs
Ola Ström
  • 4,136
  • 5
  • 22
  • 41

1 Answers1

2

You are using both androidx and android support library. Replace android support library with the existing androidx library.

  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

You can find their androidx version here

Nitin
  • 1,280
  • 1
  • 13
  • 17
  • What's the purpose of the code snippet you provided? – Zun Jul 02 '19 at 10:52
  • You need change these library with their respective androidx version. – Nitin Jul 02 '19 at 10:53
  • Isn't using `com.google.android.material` enough? It includes Support/Design. – Zun Jul 02 '19 at 10:56
  • But you can't use both libraries at same time. – Nitin Jul 02 '19 at 10:58
  • Yeah everyone knows that, it's old news. Just use the package I said since it includes support/design. Your message: `You need change these library with their respective androidx version` is slightly wrong, since not each package requires a AndroidX equivalent. – Zun Jul 02 '19 at 10:59
  • Yeah, You are right but sometimes it does not work and create ambiguities. You should review Manifest merging status for getting the exact problem. – Nitin Jul 02 '19 at 11:04