【问题标题】:Cannot resolve firebasedatabase given I have added the dependencies鉴于我已添加依赖项,无法解析 firebasedatabase
【发布时间】:2018-12-25 05:06:41
【问题描述】:

我已经添加了所需的依赖项,但即便如此,当我编写代码时,它也无法解析 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 我该怎么做?我已经被困在这里很长一段时间了

【问题讨论】:

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


    【解决方案1】:

    如果您正在实施分析,Cloud Firestore 将更有优势,而不是使用实时数据库,试试这个:

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

    【讨论】:

    • 怎么用?我是新手
    • 就像实时数据库一样,cloud firestore 中的各种功能有助于编写高效的查询,因为它具有更直观的数据模型,您还可以使用 cloud firstore 非常有效地实现云功能。此链接将帮助您为您的项目实施云存储:>firebase.google.com/docs/firestore
    猜你喜欢
    • 1970-01-01
    • 2017-05-06
    • 1970-01-01
    • 2016-06-17
    • 2021-11-07
    • 2020-05-27
    • 1970-01-01
    • 2014-01-13
    • 2021-06-13
    相关资源
    最近更新 更多