在运行Flutter测试时出现FirebaseAppPlatform.verifyExtends错误。

19

当我在我的项目中运行Bitbucket流水线时,我在执行Flutter测试期间遇到了错误:

/root/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'.
    FirebaseAppPlatform.verifyExtends(_delegate);
                        ^^^^^^^^^^^^^

当我在终端中运行flutter test时,我没有遇到这些问题。

我的流水线脚本如下:


这个回答解决了你的问题吗?错误:找不到成员'FirebaseAppPlatform.verifyExtends' - Agni Gari
5个回答

34

20

根本原因

您更新或安装的只是 Firebase 插件的子集 (firebase_core, firebase_analytics,...)

解决方案

  • Solution 1: (preferred) Updating to the latest version with flutterfire update check the docs here. But it is not easily because your project will have a lot of packages dependencies to each other like flutter version 2 or 3, so on. Anyway, it is long term solution.

  • Solution 2: (Fix to run) You can add to your pubspec.yaml

     dependency_overrides:
        firebase_core_platform_interface: 4.5.1
    
  • Solution 3: (Fix to run) Update dependencies with this below command line:

     flutter pub upgrade --major-versions
    

最后,按照以下步骤再次运行项目:

flutter clean
flutter pub get
cd ios && rm -f Podfile.lock
cd ios && pod install --repo-update
flutter run

就是这样!


5
运行命令"flutter pub upgrade --major-versions"。

1

运行以下命令 flutter pub upgrade --major-versions 然后运行以下命令 flutter upgrade


0
我通过运行flutter channel master来更改我的Flutter版本。这会自动更改pubspec.lock文件。 在我的情况下,恢复之前的pubspec.lock版本可以解决问题(需要运行pub get)。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接