Dependency resolution errors? Kotlin

Issue

I got this error and I don’t know how to fix it.

Error

These are my dependencies in application

dependencies {
    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    implementation 'com.google.firebase:firebase-database-ktx'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation platform('com.google.firebase:firebase-bom:28.4.1')
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'androidx.annotation:annotation:1.2.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation 'com.google.android.gms:play-services-maps:17.0.1'
    implementation ('com.google.zxing:core:3.3.3')
    implementation 'com.braintreepayments.api:drop-in:3.3.0'
    implementation 'com.android.volley:volley:1.2.1'
    implementation 'com.loopj.android:android-async-http:1.4.9'
}

Plzz help me to fix this errors?

Edited

I changed minsdk version but it showed another error, also add uses-sdk tools like this error, but got same error.

New Error

Solution

This problem occur when you are adding two dependencies that includes the same classes. And I think the accused one should be this braintreepayments dependency, so I recommend updating

  implementation 'com.braintreepayments.api:drop-in:3.3.0'

TO a newer version

  implementation 'com.braintreepayments.api:drop-in:5.2.2'

And for sure you have already added the mven repo to your project gradle file.

repositories {
    maven {
        url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
        credentials {
            username 'braintree_team_sdk'
            password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
        }
    }
}

For more, check this: https://github.com/braintree/braintree-android-drop-in

EDITED

Don’t forget to set the min sdk version 21 or above

defaultConfig {
        ...
        minSdkVersion 21
        ...   
    }

and remove this line if exists in the manifest

<uses-sdk android:minSdkVersion"16"/>

Answered By – Mahmoud Aly

Leave a Comment