繁体   English   中英

将Android Studio项目连接到Firebase数据库时出现问题

[英]Problems on connecting Android Studio project to Firebase database

我试图将Android Studio上的项目连接到Firebase数据库。 在尝试这样做时,我已将一些代码行添加到应用程序gradle文件中。 然后我收到了一个我一个星期都无法解决的错误……尽管这个错误我可以在模拟器上运行该应用程序,所以我继续进行连接到Firebase的过程。 完成之后,我尝试向数据库中添加一些内容,但是没有成功。 请如果您知道如何解决此问题-帮帮我:)

应用程式gradle档案:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.rotem.bepart"
        minSdkVersion 27
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.google.firebase:firebase-auth:16.0.4'
    implementation 'com.google.firebase:firebase-database:16.0.3'
    implementation 'com.google.firebase:firebase-core:16.0.4'
}
apply plugin: 'com.google.gms.google-services'

错误:错误图片

错误文字:

所有com.android.support库都必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。 找到版本28.0.0,26.1.0。 示例包括com.android.support:animated-vector-drawable:28.0.0和com.android.support:support-media-compat:26.1.0以下...(Ctrl + F1)

有一些库,工具或库的组合不兼容或可能导致错误。 一种不兼容的情况是使用不是最新版本的Android支持库版本进行编译(或者特别是低于目标targetSdkVersion的版本)。 问题ID:GradleCompatible

在您的gradle中添加此行

implementation 'com.android.support:support-v4:28.0.0'

你的gradle看起来像

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
.
.
.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM