我是编码新手,并通过udemy和在线视频学习Android Studio。直到现在我都没有问题。
我正在使用安卓 3.5.3。我在开始一个新项目时启用了Androidx。因为我在我的项目中使用FirebaseRecyclerviewAdapter从数据库中检索数据并将其列出。但是代码中无法识别FBR适配器并显示错误。
因此,我正在尝试实现以下支持依赖项
implementation 'com.firebaseui:firebase-ui-database:6.2.0'
当我同步build.gradle文件时,我看到以下错误
错误:无法解析":app@debugUnitTest/compileClasspath"的依赖关系:无法下载自动值注释.jar (com.google.auto.value:auto-value-annotations:1.6.5( 错误:无法解析 ':app@debugUnitTest/compileClasspath' 的依赖关系:无法下载 firebase-ui-common.aar (com.firebaseui:firebase-ui-common:6.1.0(
请有人指导我如何实现上述依赖项或如何在代码中识别FirebaseRecyclerviewAdapter。
build.gradle (Module(
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.vcred"
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
implementation 'com.firebaseui:firebase-ui-database:6.2.0'
}
build.gradle (project(
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
任何人都在那里将我从我面临的问题中解救出来,到目前为止,我也无法在网上或这个论坛中找到任何解决方案。希望我能够在这个论坛的专家的帮助下完成我的测试项目。
我能够解决问题,最后依赖项在build.gradle文件中同步。
下面给出了build.gradle文件中的依赖关系。
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.firebaseui:firebase-ui-database:6.2.0'