java - 为什么android studio在我添加依赖项时会出错?
问题描述
我正在构建一个人脸检测 Android 应用程序。当我在其中添加依赖项时,app/build.gradle
它会给我一个错误。这是我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.example.android.emojify"
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 fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support ', module: 'support-annotations'
})
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services-vision:10.2.0'
testImplementation 'junit:junit:4.12'
}
错误报告如下:
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
解决方案
您的 buildToolVersion 大于您的设计和 appcompat-v7。
尝试改变,
implementation 'com.android.support:design:28.0.3' //or greater than 28.0.3
implementation 'com.android.support:appcompat-v7:28.0.3' //or greater than 28.0.3
连接到互联网,然后构建您的项目。问题将得到解决。
推荐阅读
- delphi - RAD Studio 10.2.3 Jedi JVCL 安装问题
- c++ - 什么可以用作 C/C++ 中#define 指令的标识符
- filehelpers - 如何正确调用 FileHelpers.RecordTypeSelector?
- javascript - IntersectionObserver 和 ajax 加载的内容
- css - 在 React 构建中,背景不会从外部 CSS 加载
- php - WordPress - 将用户设置为在某个日期后过期
- reactjs - 在非弹出的 create-react-app 中覆盖 eslint 设置?
- filepond - Filepond、DELETE 请求和文件名
- angular - Angular 7 取消的 HTTP 请求未反映在核心 API 中
- powershell - 使用特定 NIC 测试连接性