簡體   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