Ahmed Hassan
Ahmed Hassan

Reputation: 81

Failed to resolve: com.android.support:appcompat-v7:28.+ , Error: more than one library with package name 'android.support.graphics.drawable'

I'm new to Android Studio, I tried everything to solve this problem "Failed to resolve: com.android.support:appcompat-v7:28.+ "

I tried to clean project , invalidate cash/restart and removing .idea and still the same

I'm using android studio 2.2.1 for a learning reason , and I updated it to android studio 3 and there a multiple rendering problems so I returned back to version 2.2.1

I tried to add

maven {
url 'https://maven.google.com/' name 'Google' }

So,It stuck with another problem

"Error:Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'android.support.graphics.drawable'"

Error Photo

Finally I tried to change "appcompat-v7:28.+" to "appcompat-v7:27" and it' works but still tell me that i should use the same library to avoid mistakes

This is my Gradle code:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.1"
    defaultConfig {
        applicationId "com.example.aimlive.myapplication"
        minSdkVersion 15
        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'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:28.+'
    testCompile 'junit:junit:4.12'
}

Upvotes: 8

Views: 48532

Answers (7)

amir khan
amir khan

Reputation: 1

        In case someone like me stuck for hours and find out the you have to check the maven dependency "com.android.support:appcompat-v7:28.0.0". remove the "+" sign as gradle does not like it for unpredictable versions. so i had to check the maven repository and found that i was compiling with 29 and 29 does not exist. please check below link
[""][1]

        apply plugin: 'com.android.application'

        android {
            compileSdkVersion 28
            defaultConfig {
                applicationId "com.example.amirkhan.birthday"
                minSdkVersion 15
                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'
                }
            }
        }

        dependencies {

            implementation 'com.android.support:appcompat-v7:28.0.0'

        }

    2)) Maven should be included.
    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
            google()
        }
    }


    Wallah the problem is solved


  [1]: https://mvnrepository.com/artifact/com.android.support/appcompat-v7/28.0.0

Upvotes: 0

Sungsuh Park
Sungsuh Park

Reputation: 126

I found that 'com.android.support:animated-vector-drawable' and 'com.android.support:support-vector-drawable' have a same package name in support library version 28.0.0. Normally this does not make the problem.

But if you have the following line in gradle.properties

android.uniquePackageNames = true

you will see the error

more than one library with package name 'android.support.graphics.drawable'"

If you should use the uniquePackageNames option, use androidx instead of support library 28.0.0.

Upvotes: 0

Moradnejad
Moradnejad

Reputation: 3663

try adding this to your code:

repositories {
    jcenter()
    maven {                                  // <-- Add this
        url 'https://maven.google.com/'
    }
}

Update: Now you moved on to another error:

Error: more than one library with package name 'android.support.graphics.drawable ...

To fix this, you need to change compile to implementation in dependencies part.

Upvotes: 6

Roshan
Roshan

Reputation: 401

Replace 'com.android.support:appcompat-v7:28+' by 'com.android.support:appcompat-v7:28.0.0'

and add below dependencies

implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'

Upvotes: 7

NAP-Developer
NAP-Developer

Reputation: 3796

Try this code, hope it will be working. Thanks

build.gradle (Project)

 dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

build.gradle (app)

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
    applicationId "YOUR_PACKAGE_NAME"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    renderscriptTargetApi 19
    renderscriptSupportModeEnabled true

    // Enabling multidex support.
    multiDexEnabled true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

lintOptions {
    abortOnError false
}

}

dependencies check for implementation

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

}

Upvotes: 0

NAP-Developer
NAP-Developer

Reputation: 3796

Try this one, hope it is working

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'

dependencies

  classpath 'com.android.tools.build:gradle:3.1.4'

android

  compileSdkVersion 28
  minSdkVersion 21
  targetSdkVersion 28

Upvotes: 4

Anant Shah
Anant Shah

Reputation: 4044

if you are using

    compileSdkVersion 28

add in your dependencies below code

    implementation 'com.android.support:appcompat-v7:28.0.0-alpha'

this is the link

Upvotes: 4

Related Questions