简体   繁体   English

无法解决:com.android.support:appcompat-v7:28.+,错误:包含名称为'android.support.graphics.drawable'的多个库

[英]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.+ " 我是Android Studio的新手,我尝试了一切来解决这个问题“无法解决:com.android.support:appcompat-v7:28.+”

I tried to clean project , invalidate cash/restart and removing .idea and still the same 我试图清理项目,无效现金/重新启动和删除.idea仍然相同

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 我使用android studio 2.2.1是出于学习的原因,我将它更新到android studio 3并且出现了多个渲染问题,所以我又回到了2.2.1版本

I tried to add 我试着补充一下

maven { maven {
url ' https://maven.google.com/ ' name 'Google' } 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 最后我尝试将“appcompat-v7:28. +”更改为“appcompat-v7:27”并且它“有效但仍然告诉我应该使用相同的库来避免错误

This is my Gradle code: 这是我的Gradle代码:

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'
}

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 ... 错误:包含名称为'android.support.graphics.drawable的多个库...

To fix this, you need to change compile to implementation in dependencies part. 要解决此问题,您需要在dependencies部分中将compile更改为implementation

Replace 'com.android.support:appcompat-v7:28+' by 'com.android.support:appcompat-v7:28.0.0' 'com.android.support:appcompat-v7:28+'替换'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'

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 这是链接

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

Try this code, hope it will be working. 试试这段代码,希望它能运作。 Thanks 谢谢

build.gradle (Project) build.gradle(项目)

 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) 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')

} }

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. 我发现'com.android.support:animated-vector-drawable'和'com.android.support:support-vector-drawable'在支持库版本28.0.0中具有相同的包名称。 Normally this does not make the problem. 通常这不会产生问题。

But if you have the following line in gradle.properties 但是如果你在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. 如果您应该使用uniquePackageNames选项,请使用androidx而不是支持库28.0.0。

        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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:任务&#39;:app:processDebugResources&#39;的执行失败。 &gt;错误:多个库的软件包名称为“ android.support.graphics.drawable” - Error:Execution failed for task ':app:processDebugResources'. > Error: more than one library with package name 'android.support.graphics.drawable' 多个库,包名称为“ android.support.graphics.drawable” - more than one library with package name 'android.support.graphics.drawable' 如何修复包名称 &#39;android.support.graphics.drawable&#39; 用于:com.android.support:animated-vector-drawable:28.0.0 - How Fix Package name 'android.support.graphics.drawable' used in: com.android.support:animated-vector-drawable:28.0.0 Android Studio <Failed to resolve: com.android.support:appcompat-v7:28.0.0> - Android Studio <Failed to resolve: com.android.support:appcompat-v7:28.0.0> 实施 'com.android.support:appcompat-v7:28.0.0' - 错误 - implementation 'com.android.support:appcompat-v7:28.0.0' - Error gradle 构建错误:无法解析 com.android.support:appcompat-v7:28.0.0 - gradle build error: Could not resolve com.android.support:appcompat-v7:28.0.0 什么是com.android.support:appcompat-v7? - What is com.android.support:appcompat-v7? &#39;实施&#39;com.android.support:appcompat-v7:27.1.1&#39;问题 - 'Implementation 'com.android.support: appcompat-v7:27.1.1' issue 我收到错误消息&#39;编译&#39;com.android.support:design:23.0.1&#39;编译&#39;com.android.support:appcompat-v7:23.0.1&#39; - I am getting the error' compile 'com.android.support:design:23.0.1' compile 'com.android.support:appcompat-v7:23.0.1' 错误“找不到com.android.support:appcompat-v7:22.2.0” - Error “Could not find com.android.support:appcompat-v7:22.2.0”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM