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 我的应用程序在Android设备上运行时未运行';s在iPhone上运行_Firebase_Flutter_Android Studio_Push Notification - Fatal编程技术网

Firebase 我的应用程序在Android设备上运行时未运行';s在iPhone上运行

Firebase 我的应用程序在Android设备上运行时未运行';s在iPhone上运行,firebase,flutter,android-studio,push-notification,Firebase,Flutter,Android Studio,Push Notification,我正在MAC M1中使用Android Studio编写我的加载项Flatter 2.0,它在iPhone中运行良好,但是,当我尝试在Android设备中运行它时,我遇到以下错误: Launching lib/main.dart on moto g 30 in debug mode... Running Gradle task 'assembleDebug'... /Users/Khalid/AndroidStudioProjects/makani/android/app/src/main/ko

我正在MAC M1中使用Android Studio编写我的加载项Flatter 2.0,它在iPhone中运行良好,但是,当我尝试在Android设备中运行它时,我遇到以下错误:

Launching lib/main.dart on moto g 30 in debug mode...
Running Gradle task 'assembleDebug'...
/Users/Khalid/AndroidStudioProjects/makani/android/app/src/main/kotlin/com/itdar/makani/Application.java:7: error: package io.flutter.plugins.firebasemessaging does not exist
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;
                                           ^
/Users/Khalid/AndroidStudioProjects/makani/android/app/src/main/kotlin/com/itdar/makani/Application.java:8: error: package io.flutter.plugins.firebasemessaging does not exist
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
                                           ^
/Users/Khalid/AndroidStudioProjects/makani/android/app/src/main/kotlin/com/itdar/makani/Application.java:14: error: cannot find symbol
        FlutterFirebaseMessagingService.setPluginRegistrant(this);
        ^
  symbol:   variable FlutterFirebaseMessagingService
  location: class Application
/Users/Khalid/AndroidStudioProjects/makani/android/app/src/main/kotlin/com/itdar/makani/Application.java:19: error: cannot find symbol
        FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
        ^
  symbol:   variable FirebaseMessagingPlugin
  location: class Application
Note: /Users/Khalid/AndroidStudioProjects/makani/android/app/src/main/kotlin/com/itdar/makani/Application.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1

这是我的颤振医生:

Khalid@KhalidM1 makani % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.5, on macOS 11.2.3 20D91 darwin-arm, locale en-SA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.55.1)
[✓] Connected device (2 available)

• No issues found!

我的颤振版本是:

Flutter 2.0.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1d9032c7e1 (3 days ago) • 2021-04-29 17:37:58 -0700
Engine • revision 05e680e202
Tools • Dart 2.12.3

谢谢。

您似乎还没有为Android正确配置Firebase消息库。你有没有试过专门针对android的配置教程?我试过,但我不知道有什么问题!您是否配置了插件注册表?如何配置插件注册表?你能给我一些url来帮助我怎么做吗?