作者:王-闻 | 来源:互联网 | 2022-12-10 14:40
如何解决《无法解决:com.android.support:appcompat-v7:28.+,错误:包名称为“android.support.graphics.drawable”的多个库》经验,为你挑选了2个好方法。
我是Android Studio的新手,我竭尽全力解决此问题“无法解决:com.android.support:appcompat-v7:28.+”
我试图清理项目,使现金/重新启动无效,并删除.idea,但还是一样
我出于学习原因而使用android studio 2.2.1,并将其更新为android studio 3,并且出现了多个渲染问题,因此我返回了2.2.1版
我尝试添加
maven {
url'https : //maven.google.com/'name'Google '}
所以,它还有另一个问题
"Error:Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'android.support.graphics.drawable'"
错误照片
最后,我尝试将“ appcompat-v7:28. +”更改为“ appcompat-v7:27”,它可以正常工作,但仍然告诉我应该使用相同的库以避免错误
这是我的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'
}
Moradnejad..
6
尝试将其添加到您的代码中:
repositories {
jcenter()
maven { // <-- Add this
url 'https://maven.google.com/'
}
}
更新:现在您转到另一个错误:
错误:多个库的包名称为“ android.support.graphics.drawable”。
为了解决这个问题,您需要更改compile
到implementation
的dependencies
部分。
1> Moradnejad..:
尝试将其添加到您的代码中:
repositories {
jcenter()
maven { // <-- Add this
url 'https://maven.google.com/'
}
}
更新:现在您转到另一个错误:
错误:多个库的包名称为“ android.support.graphics.drawable”。
为了解决这个问题,您需要更改compile
到implementation
的dependencies
部分。
2> 小智..:
替换'com.android.support:appcompat-v7:28+'
为'com.android.support:appcompat-v7:28.0.0'
并添加以下依赖项
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'