如何解决为什么在尝试将 firebase 添加到 flutter 时会出现此错误“已弃用 API”
我在尝试在 Flutter 项目上添加 Firebase 时遇到错误。 当我运行应用程序时出现错误:
Launching lib\main.dart on sdk gphone x86 in debug mode...
Note: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-
1.0.1\android\src\main\java\io\Flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or
overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-
1.0.1\android\src\main\java\io\Flutter\plugins\firebase\firestore\FlutterFirebaseFirestorePlugin.java
uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore- 1.0.1\android\src\main\java\io\Flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.
java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth- 1.0.1\android\src\main\java\io\Flutter\plugins\firebase\auth\FlutterFirebaseAuthPlugin.java uses or
overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
√ Built build\app\outputs\Flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:50487/Plr_UpKjauM=/ws
解决方法
这些事情中的一个或它们的组合应该可以解决您的问题
-
在
android/app/build.grade
文件中将您的构建版本升级到 23 -
flutter clean
-
在
android/app/build.grade
中,更新依赖项,例如
dependencies {
...
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
-
在终端中运行
flutter pub upgrade
或从 pubspec.yaml 文件进行 pub 升级
将检查一些已知的修复方法,并在我更新答案时通知您
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。