android - 无法在 Android Studio 中连接到 Firebase
问题描述
我已经尝试了所有解决方案,但仍然无法将我的应用连接到 Firebase 服务器
https://i.stack.imgur.com/0WZbP.jpg
注意到我在 root 中使用这个 build.gradle ;
// 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.3.0'
classpath 'com.google.gms:google-services:4.2.0'
buildscript {
}
}
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
allprojects {
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
而这个用于 App gradle ;
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
signingConfigs {
config1 {
keyAlias 'key0'
keyPassword '000000'
storeFile file('C:/filepath/filename.jks')
storePassword 'password'
}
}
defaultConfig {
applicationId "com.example.last"
minSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.config1
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileSdkVersion 28
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
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-core:16.0.6'
android {
// ...
}}
apply plugin: 'com.google.gms.google-services'
我安装了 google-services.json 文件
没有任何工作,我完成了所有必需的步骤,仍然没有连接
有人可以帮助我吗?
谢谢
解决方案
您必须构建并运行您的第一个应用程序才能在“运行您的应用程序以验证安装”上打勾。
推荐阅读
- java - android studio 3.3.1 升级后如何解决android studio 依赖问题?
- vue.js - 如何在 Nuxt.js 的嵌套路由中创建可选参数?
- angular - Angular7 - 尝试根据从 api 接收的内容创建表。错误:无法读取未定义的属性“StoreLogId”
- css - 为什么在分析代码时缩进很重要?
- c# - 生成和读取阿拉伯字母条形码时出错
- python - 熊猫融化以获得多个变量和值列
- php - 如何将此数组从最高数量到最低数量限制为 3 个项目?
- keras - 带有回调的 Keras 评估生成器
- javascript - 如何使用按钮 Bootstrap Accordion 更改(-,+)符号?
- webgl - 带有 mipmap 级别的 webgl2 上的 glFramebufferTexture2D