firebase - 我的应用在 iPhone 上运行时未在 Android 设备上运行
问题描述
我正在使用 MAC M1 中的 Android Studio 对 Flutter 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
谢谢。
解决方案
推荐阅读
- ios - com.apple.coremedia.player.async 上的 iOS 12-only QuartzCore 崩溃
- vb.net - C# OrderBy 的 VB MVC 等价物
- node.js - 如何处理 Node.js 中 https.get 的错误并防止应用程序崩溃?
- javascript - 为什么对象引用相等没有明显快于字符串相等?
- java - 通过 asynctask 检查互联网连接的完整代码
- javascript - 通过 state.value ReactJS 将 textarea 值复制到新组件
- php - 如何在 PHP for 循环中使用 mySQL 数据?
- python - 将用户代理实现到 urllib.request.build_opener 的正确方法
- php - 删除值重复数组php
- matlab - 使用 Simulink 和 tf() 的同一系统的不同结果