Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase在颤振问题中的实现_Firebase_Flutter_Dart - Fatal编程技术网

Firebase在颤振问题中的实现

Firebase在颤振问题中的实现,firebase,flutter,dart,Firebase,Flutter,Dart,我在颤振项目中实现firebase时遇到了很多问题,因为gradle错误,我不得不从4.3恢复到4.2。现在要在我的模拟器上加载它要花很长时间,我切换到了一个实际的设备,但安装程序无法打开。最近有没有人在flutter项目中实现了firebase消息传递?我打算放弃使用它的想法 我在build.gradle和app/build.gradle以及我的yaml文件中添加了所需的行,就是这样。我从今天(2019-09-27 20:00 UTC,因为颤振构建可能随时中断)开始工作,我会让你知道我的构建中

我在颤振项目中实现firebase时遇到了很多问题,因为gradle错误,我不得不从4.3恢复到4.2。现在要在我的模拟器上加载它要花很长时间,我切换到了一个实际的设备,但安装程序无法打开。最近有没有人在flutter项目中实现了firebase消息传递?我打算放弃使用它的想法


我在build.gradle和app/build.gradle以及我的yaml文件中添加了所需的行,就是这样。

我从今天(2019-09-27 20:00 UTC,因为颤振构建可能随时中断)开始工作,我会让你知道我的构建中有什么内容,以便让它工作(对于评论来说有点太长了)。我已经测试过它在iOS和安卓系统中都能正常工作,并且可以正确构建以供发布

首先,切换到颤振主通道
颤振主通道
。这是为了解决gradle appbundle命名问题

公开发行

dependencies:
  firebase_messaging: ^5.1.6
android/build.gradle(注意gradle版本的变化)

android/gradle.properties(更改为AndroidX)

android/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
android/app/build.gradle

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation 'com.google.firebase:firebase-messaging:20.0.0'
}

apply plugin: 'com.google.gms.google-services'
在同一个文件中,确保在
defaultConfig
部分中已将
testInstrumentationRunner
更改如下:

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
android/app/src/main/AndroidManifest.xml

<intent-filter>
  <action android:name="FLUTTER_NOTIFICATION_CLICK" />
  <category android:name="android.intent.category.DEFAULT" />
</intent-filter>


确保已将您的
google services.json
添加到android/app文件夹中。我想在某个时候这一切都会被很好地记录下来,但目前它有点疯狂。

我也有一些问题,所以我刚刚使用了gradleI的3.3.0版。通过从我的yaml文件中删除firebase_core,我能够修复它。你是在接收通知还是在应用程序中发送通知?我也在尝试从应用程序发送。如果我想从应用程序发送,我会在firebase上创建一个函数,当应用程序通过HTTP请求发送时,该函数将处理它。
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
<intent-filter>
  <action android:name="FLUTTER_NOTIFICATION_CLICK" />
  <category android:name="android.intent.category.DEFAULT" />
</intent-filter>