【问题标题】:why having this error 'deprecated API' when trying added firebase to flutter为什么在尝试将firebase添加到flutter时出现此错误“已弃用的API”
【发布时间】:2021-06-08 16:07:55
【问题描述】:

我在尝试在 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

【问题讨论】:

    标签: firebase flutter


    【解决方案1】:

    这些事情中的一个或它们的组合应该可以解决您的问题

    1. android/app/build.grade 文件中将您的构建版本升级到 23

    2. flutter clean

    3. android/app/build.grade 中,更新依赖项

    dependencies {
        ...
        androidTestImplementation 'androidx.test:runner:1.2.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    }
    
    1. 在终端中运行 flutter pub upgrade 或从 pubspec.yaml 文件进行 pub 升级

    2. 试试这个答案https://stackoverflow.com/a/59531270/13858991

    将检查一些更已知的修复方法,并在我更新答案时通知您

    【讨论】:

    • 这不是错误而是警告。即使出现此警告,应用程序也应该可以正常运行,但不应该出现警告,所以让我们尝试修复它。粘贴 flutter run -Xlint:deprecation 的输出。还添加您正在使用的依赖项(来自 pubspec.yaml)
    • 依赖项:flutter:sdk:flutter firebase_core:^1.0.1 cloud_firestore:^1.0.1 firebase_auth:^1.0.1
    • 错误是在你做了一些不同的事情后立即出现的吗?
    • 我只是按照集成firebase的说明进行操作,我真的什么都没做!
    • 在终端中执行颤振医生并发布问题,在更改为 minsdkversion 23 后你会得到什么并进行颤振清洁
    猜你喜欢
    • 2014-03-10
    • 1970-01-01
    • 1970-01-01
    • 2022-06-13
    • 1970-01-01
    • 2013-03-07
    • 2021-08-22
    • 1970-01-01
    • 2019-04-20
    相关资源
    最近更新 更多