Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to learn android studio. In this computer ( its not mine) android studio version is 2.2.3

When i created a new project while gradle build an error occurs.

Error:Execution failed for task ':app:processDebugResources'.

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

I have been searching for this error for one day. I haven't found the same topic anywhere so i have to open this thread.Thanks for all answers from now.

this is build.gradle(project:myapplication2)

 buildscript {
 repositories {
     jcenter()
 }
 dependencies {
     classpath 'com.android.tools.build:gradle:2.2.3'

     // NOTE: Do not place your application dependencies here; they belong
     // in the individual module build.gradle files
  }
}
allprojects {
repositories {
    jcenter()
    maven {
       url "https://maven.google.com"
    }
}
}

task clean(type: Delete) {
   delete rootProject.buildDir
}

and this is build.gradle(module:app)

   apply plugin: 'com.android.application'

 android {
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
    applicationId "com.example.alicetin.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'])
  compile 'com.android.support:appcompat-v7:28.+'
  testCompile 'junit:junit:4.12'
}
like image 542
Ali Berat Çetin Avatar asked Jun 25 '18 13:06

Ali Berat Çetin


5 Answers

Try

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

instead of

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

I faced the same issue and It worked for me.

like image 100
Shrishti Gupta Avatar answered Nov 02 '22 13:11

Shrishti Gupta


I faced the exact same problem although my build.gradle(app) file has already been updated with the latest production version of SDK, tools and libraries.

The only thing left to check is the gradle version and in fact there was a warning saying that a newer gradle version is available. Please refer to image below.

more than one library with 'android.support.graphics.drawable'

Once I uprev the gradle version, the error got resolved.

So please upgrade your gradle version from 2.2.3 to a newer version.

like image 23
Razak Avatar answered Nov 02 '22 12:11

Razak


"com.android.support:appcompat-v7" depends on "support-vector-drawable" and "com.android.support:design" depends on "animated-vector-drawable"

Add this to your build.gradle:

configurations.all {
        exclude module: 'animated-vector-drawable'
}

Sush as:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    // ...
    configurations.all {
        exclude module: 'animated-vector-drawable'
    }
}
like image 43
永东何 Avatar answered Nov 02 '22 12:11

永东何


Try

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

instead of

compile 'com.android.support:appcompat-v7:28.+'

appcompat-v7 version 28 is still alpha

like image 28
SamVV Avatar answered Nov 02 '22 13:11

SamVV


Use:

compile 'com.android.support:appcompat-v7:27.+'

Instead of:

compile 'com.android.support:appcompat-v7:28.+'
like image 43
abir-cse Avatar answered Nov 02 '22 14:11

abir-cse