提问人:Meti 提问时间:6/23/2021 最后编辑:Aniruddh PariharMeti 更新时间:6/25/2021 访问量:323
添加 Room Library 时 android Studio 中的 Gradle 构建错误
Gradle building error in android Studio when adding Room Library
问:
当我在项目中添加 Room 库时,我的文件中出现错误build.gradle
这是我的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文件,但仍然无法正常工作。
如果有人知道如何解决此错误,请提供帮助。
答: 暂无答案
评论