android - 添加房间库时Android Studio中的Gradle构建错误
问题描述
build.gradle
在我的项目中添加 Room 库时,我的文件中出现错误
这是我的build.gradle
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.mvp_sample_todolist"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary(true)
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "androidx.room:room-runtime:2.3.0"
annotationProcessor "androidx.room:room-compiler:2.3.0"
}
以下是我得到的错误
Execution failed for task ':app:javaPreCompileDebug'.
> Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'.
> Could not find annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/annotation/annotation/1.1.0/annotation-1.1.0.jar
我什至试图删除项目的 gradle 文件,但仍然没有用。
如果有人知道如何解决此错误,请提供帮助。
解决方案
推荐阅读
- javascript - javascript 正则表达式匹配,包括非捕获组
- signal-processing - 如何使用 GNURadio 控制 OFDM 中的带宽
- gitbook - gitbook 编辑器缺少文件内容仅显示文件
- javascript - 如何使用自定义按钮发送到 JQGrid 的 editurl?
- javascript - 如何将 CanJS 与 VelocityJS 一起使用?
- css - CSS 过渡不起作用
- php - 刷新页面时 https 更改为 http
- regex - HTML5输入模式(防止先到0)
- xhtml - 哪些输出格式支持 action="passthrough"?(XHTML 没有 - 皱眉)
- php - 如何正确获取 url 中的元素