如何解决无法解决:support-compat
How to fix Failed to resolve: support-compat
为什么不帮帮我?
在我的应用程序中,我想使用 ButterKnife
库并添加此库依赖项。但是当添加此库并单击 Sync 按钮时。
不是 sync 项目并显示错误。
gradle.Build(项目):
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle.build(应用):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.mohammad.ncistutorial"
minSdkVersion 14
targetSdkVersion 27
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
错误信息:
Failed to resolve: support-compat
我该如何解决?
请尝试添加依赖行,排除应用程序压缩支持组。
implementation 'com.jakewharton:butterknife:8.8.1',{
exclude group: 'com.android.support'
})
使用此代码
implementation 'com.jakewharton:butterknife:9.0.0-rc2',{
exclude group: 'com.android.support'
}
检查您的 .gradle 文件版本。更新或更改最新的 gradle 版本。
为什么不帮帮我?
在我的应用程序中,我想使用 ButterKnife
库并添加此库依赖项。但是当添加此库并单击 Sync 按钮时。
不是 sync 项目并显示错误。
gradle.Build(项目):
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle.build(应用):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.mohammad.ncistutorial"
minSdkVersion 14
targetSdkVersion 27
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
错误信息:
Failed to resolve: support-compat
我该如何解决?
请尝试添加依赖行,排除应用程序压缩支持组。
implementation 'com.jakewharton:butterknife:8.8.1',{
exclude group: 'com.android.support'
})
使用此代码
implementation 'com.jakewharton:butterknife:9.0.0-rc2',{
exclude group: 'com.android.support'
}
检查您的 .gradle 文件版本。更新或更改最新的 gradle 版本。