我已经在我的应用程序中安装了一个Firebase插件,并复制了google-service.json文件,但是当我运行该应用程序时,它没有打开
我只有一个插件,cloud_firestore: ^0.13.7
我的应用程序级别的build.gradle文件是
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.rotaryadyar"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.android.support:multidex:1.0.3'
}
在安装了Firebase和google文件后,它显示了一些错误,然后我添加了此multidexEnabled,但未显示错误,但在应用程序构建未打开之后
答案 0 :(得分:0)
您是否尝试过使缓存无效并重新启动android studio,但我遇到了这个问题,之后我的应用开始运行或降低到版本0.13.6
答案 1 :(得分:0)
可能是集成未完成。
如Firebase助手所述,修改android / build.gradle文件和android / app / build.gradle文件以添加Google服务插件。确保您的android / build.gradle文件包含此处所述的maven.google.com。
我个人建议您按照firebase_messaging软件包的集成步骤1-3进行操作,
使用Firebase控制台将Android应用添加到您的项目中:跟随助手,下载生成的google-services.json
文件并将其放在android/app
内。
将类路径添加到[project] /android/build.gradle文件中。
dependencies {
// Example existing classpath
classpath 'com.android.tools.build:gradle:3.5.3'
// Add the google services classpath
classpath 'com.google.gms:google-services:4.3.2'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
请注意:集成明确要求将apply plugin: 'com.google.gms.google-services'
放在文件末尾。但是,您可以在文件中间找到它。也许这是你的错误。