美文网首页
2022-04-13 fair笔记

2022-04-13 fair笔记

作者: 我是小胡胡分胡 | 来源:发表于2022-04-13 19:54 被阅读0次

    demo:
    https://github.com/hc2088/fairdemo

    按照 FlutterFair接入文档操作Counting计数器

    flutter2.5.0 接fair 问题

    • 1、flutter pub run build_runner build
      报错
       Failed to build build_runner:build_runner:
    ../../shared/opt/fvm/versions/2.5.0/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:258:50: Error: The property 'displayString' is defined in multiple extensions for 'TargetKind' and neither is more specific.
     - 'TargetKind' is from 'package:meta/meta_meta.dart' ('../../shared/opt/fvm/versions/2.5.0/.pub-cache/hosted/pub.flutter-io.cn/meta-1.7.0/lib/meta_meta.dart').
    Try using an explicit extension application of the wanted extension or hiding unwanted extensions from scope.
            var kindNames = kinds.map((kind) => kind.displayString).toList()
                                                     ^^^^^^^^^^^^^
    ../../shared/opt/fvm/versions/2.5.0/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:1950:14: Context: This is one of the extension members.
      String get displayString {
                 ^^^^^^^^^^^^^
    ../../shared/opt/fvm/versions/2.5.0/.pub-cache/hosted/pub.flutter-io.cn/meta-1.7.0/lib/meta_meta.dart:91:14: Context: This is one of the extension members.
      String get displayString {
                 ^^^^^^^^^^^^^
    ../../shared/opt/fvm/versions/2.5.0/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.41.2/lib/src/error/best_practices_verifier.dart:260:36: Error: The getter 'commaSeparatedWithOr' isn't defined for the class 'List<dynamic>'.
     - 'List' is from 'dart:core'.
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'commaSeparatedWithOr'.
            var validKinds = kindNames.commaSeparatedWithOr;
                                       ^^^^^^^^^^^^^^^^^^^^
    pub finished with exit code 1
    
    

    报错分析:

    查看 flutter 2.5.0 dart版本 是2.14.0
    $FLUTTER_ROOT/bin/cache/dart-sdk/version

    查看flutter 2.5.0依赖的meta 版本
    $FLUTTER_ROOT/packages/flutter/pubspec.yaml

    flutter flutter-meta版本 fair compiler- analyzer analyzer - meta
    flutter1.17.3 meta: 1.1.8 analyzer: ^0.41.2 meta: ^1.2.3
    flutter 1.22.4 meta: 1.3.0-nullsafety.3 analyzer: ^0.41.2 meta: ^1.2.3
    flutter 2.0.6 meta: 1.3.0 analyzer: ^0.41.2 meta: ^1.2.3
    flutter 2.2.2 meta: 1.3.0 analyzer: ^0.41.2 meta: ^1.2.3
    flutter 2.5.0 meta: 1.7.0 analyzer: ^0.41.2 meta: ^1.2.3

    meta最高版本1.2.4 ,从1.3.0开始是安全版本,最新1.7.0
    analyzer最高版本0.41.2,从1.0.0开始是空安全版本,最新4.0.0

    flutter2.5.0 和flutter1.17.3都不无法使用fair compiler

    • 2、flutter pub get
      没问题

    • 3、使用模拟器运行

    image.png

    但是用file 查看
    ./fair/fair/ios/FairDynamicFlutter/Products/FairDynamicFlutter.framework/FairDynamicFlutter

    fair/fair/ios/FairDynamicFlutter/Products/FairDynamicFlutter.framework/FairDynamicFlutter: Mach-O universal binary with 4 architectures: [arm_v7:Mach-O dynamically linked shared library arm_v7] [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
    /Volumes/huc/xx/fair/fair/ios/FairDynamicFlutter/Products/FairDynamicFlutter.fram
    

    分明是支持4种架构
    arm_v7
    x86_64
    i386
    arm64

    切到真机运行成功了


    image.png

    flutter 2.5.0
    IOS插件 FairDynamicFlutter.framework 不支持 模拟器运行

    flutter 2.0.6接fair 问题

    报错:


    flutter2.0.6pub get成功但是运行失败.jpg.jpg
    flutter dart
    flutter1.17.3 dart 2.8.4
    flutter 1.22.4 dart 2.10.4
    flutter 2.0.6 dart 2.12.3
    flutter 2.2.2 dart 2.13.3
    flutter 2.5.0 dart 2.14.0

    解决方法:

    pubspec.yaml
    sdk: ">=2.10.4 <3.0.0"改为 sdk: ">=2.8.0 <3.0.0"就够了

     sudo xattr -d com.apple.quarantine $FLUTTER_ROOT/bin/cache/artifacts/usbmuxd/iproxy
    

    执行完上面命令后
    2.8.0和2.10.4好像又都没问题了

    终于算是运行成功了

    • flutter pub get 添加fair plugin
    • flutter pub run build_runner build 运行fair compiler生成fair
      bundle
    • fair plugin FairDynamicFlutter.framework 运行模拟器也没问题
    image.png

    相关文章

      网友评论

          本文标题:2022-04-13 fair笔记

          本文链接:https://www.haomeiwen.com/subject/odoasrtx.html