首页 > 解决方案 > Firebase 无法连接到我的 android 应用程序

问题描述

当我在模拟器或真实设备上安装我的应用程序时,我正在尝试在我的 android 应用程序上设置 firebase,firebase 无法识别我的安装并坚持安装 firebase 的第四步(运行您的应用程序以验证安装)我跳过那个但在安装号或通知接收器计数不会显示我的应用程序。有趣的是我在一个测试项目中实现了它并且它工作。

这是我的毕业典礼

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 29
defaultConfig {
    vectorDrawables.useSupportLibrary = true
    applicationId "netherland.com.app.vanlaartsoapp"
    minSdkVersion 17
    targetSdkVersion 29
    versionCode 10
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha08'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'

implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.karumi:dexter:5.0.0'
implementation 'androidx.room:room-runtime:2.2.0-alpha01'
annotationProcessor "androidx.room:room-compiler:2.2.0-alpha01"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'


implementation 'com.google.firebase:firebase-messaging:20.0.0'

}

应用插件:'com.google.gms.google-services'

标签: androidfirebasepush-notification

解决方案


确保将 google.json 文件添加到您的项目中


推荐阅读