Android的报错提示:Failed to resolve: com.android.support:appcompat-v7:28.0.0
今天,简单讲讲Android studio编译报错:Failed to resolve: com.android.support:appcompat-v7:28.0.0的问题。这个问题其实之前遇到过,今天又遇到了。所以记录一下。总的来说,就是Android studio的SDK工具版本低于工程需要的SDK工具版本,SDK Build-Tools与工程所需的不一致。具体讲解如下:具体解决方案:1.既
Android studio编译报错:Failed to resolve: com.android.support:appcompat-v7:28.0.0
总的来说,就是Android studio
的SDK
工具版本低于工程需要的SDK
工具版本,SDK Build-Tools
与工程所需的不一致。具体讲解如下:
具体解决:
1.如果版本有问题,就先去了解自己的电脑安装的SDK工具版本,点开SDK Manager图标,然后选中Updates
就可以看到了
这里我的 sdk 工具版本就是26.1.1了
2.清楚了自己的sdk 工具版本后,接下来我们继续查看版本,接下来是看sdk 构建工具(sdk Build-Tools)的版本,还是在sdk manager上操作,这次选中 Android SDK后,再在右边选中SDK Tools(只看打勾选项就行)
看了这张图,似乎就能明白些什么了对吧,你会发现,我这里是的 Android SDK Build-Tools (就是我前面一直提到的sdk 构建工具)版本是27,而我的SDK Tools才是26,
很明显版本就低了,但这些并不会直接造成项目报错,看完这些数据,我们接下来再看一张截图
3.点开项目构建文件Gradle Scripts,再继续点击build.gradle(Module:app)ps:有两个名字相同的,选第二个,看下面代码的注释行就可以了
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.arcsoft.arcfacedemo"
minSdkVersion 19
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.0.0'
compile 'com.android.support.constraint:constraint-layout:1.1.3'
testCompile 'junit:junit:4.12'
compile 'com.android.support.test:runner:1.0.2'
compile 'com.android.support.test.espresso:espresso-core:3.0.2'
compile 'com.android.support:recyclerview-v7:28.0.0'
compile 'com.github.bumptech.glide:glide:4.7.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.16'
compile 'io.reactivex.rxjava2:rxandroid:2.0.2'
}
我们来分析下appcompat-v7:27.+
上面我们查到我们的sdk工具版本是26,工程需要的版本27,把27改为26,看看结果怎么样
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.arcsoft.arcfacedemo"
minSdkVersion 19
targetSdkVersion 26
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:26.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
// compile 'com.android.support.test:runner:1.0.2'
compile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support:recyclerview-v7:26.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'io.reactivex.rxjava2:rxjava:2.1.16'
compile 'io.reactivex.rxjava2:rxandroid:2.0.2'
}
点击“Sync Now”后报错提示:
SDK版本又要低吧,试试把26改为25,解决了就好
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.arcsoft.arcfacedemo"
minSdkVersion 19
targetSdkVersion 25
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:25.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
// compile 'com.android.support.test:runner:1.0.2'
compile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'io.reactivex.rxjava2:rxjava:2.1.16'
compile 'io.reactivex.rxjava2:rxandroid:2.0.2'
}
嗯 好 我讲完了
更多推荐
所有评论(0)