鉴于我已添加依赖项,因此无法解析firebasedatabase

时间:2018-12-25 05:06:41

标签: android firebase android-studio firebase-realtime-database

我已经添加了必需的依赖项,但是即使在编写代码时,它也无法解析firebasedatabase

构建gradle模块应用程序:

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
    applicationId "com.example.kiit.questionme2"
    minSdkVersion 21
    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'])
//noinspection GradleCompatible
implementation "com.google.firebase:firebase-auth:16.1.0"
implementation "com.google.firebase:firebase-database:16.0.5"
implementation "com.google.firebase:firebase-core:16.0.6"
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- 
core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'

构建项目:

// 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.2.1'
    classpath 'com.google.gms:google-services:4.0.1'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    maven {
        url "https://maven.google.com" // Google's Maven repository
    }
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我想我已经添加了必需的依赖项,但是我的系统无法解决firebasedatabase怎么办?我已经在这里停留了很长一段时间

1 个答案:

答案 0 :(得分:0)

如果您要实施Google Analytics(分析),请尝试使用Cloud Firestore,而不是使用Realtime Database:

 >com.google.firebase:firebase-firestore:17.1.5