Android的报错提示:Failed to resolve: com.android.support:appcompat-v7:28.0.0
2023-09-14 09:13:59 时间
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'
}
嗯 好 我讲完了
相关文章
- [Android Pro] android Flag介绍
- android binder机制详解
- android上拉下拉加载更多数据
- Android API之android.provider.ContactsContract.Contacts
- Android开发学习---使用Intelij idea 13.1 进行android 开发
- [Android] Firebase on Android
- WSL(Linux子系统) gedit 报错 failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory)
- Android问题笔记 - 编译报错Task :app:compileDebugJavaWithJavac FAILED
- 【Android笔记81】Android之RxJava的介绍及其使用
- Android点击按键改变按键背景图片-选择器
- Android 9.0 延时开机动画解决首次开机黑屏和去掉android正在启动的提示框
- Android 10.0 屏蔽掉无响应和已停止对话框
- Android API Guides---Tasks and Back Stack
- android 解决报错 installation failed with message Failed to finalize session : INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed parse during installPackageLI: Failed to read manifest from /xx/xx/xx.apk
- 【Android Gradle 插件】build.gradle 中的 android 配置 ( 配置项 | compileSdkVersion 配置 | buildToolsVersion 配置 )
- 【Android 逆向】Android 权限 ( Android 逆向中使用的 android.permission 权限 | Android 系统中的 Linux 用户权限 )
- Android 使用 DownloadManager 管理系统下载任务的方法,android管理系统
- 解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题
- Android - 控件android:ems属性
- Android的java的报错提示:Could not find com.android.tools.build:gradle:4.2.2.
- Android的报错提示:Failed to resolve: io.reactivex.rxjava2:rxandroid:2.1.0
- Android Studio NDK报错:mips64el-linux-android-strip 找不到