【问题标题】:Error building flutter iOS project using a plugin with static library使用带有静态库的插件构建 Flutter iOS 项目时出错
【发布时间】:2020-05-24 00:38:07
【问题描述】:

目前我正在尝试将此插件 flutter-zsdk 用作我的项目的依赖项,但我无法为 iOS 构建/运行该项目。对于 Android,该项目可以正常构建/运行,但对于 iOS,我收到以下错误:

Running Xcode build
Xcode build done.                                            3.0s
Failed to build iOS app
Error output from Xcode build:
↳
    2020-02-07 12:20:44.583 xcodebuild[29722:10555466]  DTDeviceKit: deviceType from 00008006-001C498E2206002E was NULL
    2020-02-07 12:20:44.584 xcodebuild[29722:10555578]  DTDeviceKit: deviceType from 00008006-001C498E2206002E was NULL
    2020-02-07 12:20:44.677 xcodebuild[29722:10555344] [MT] DTDeviceKit: deviceType from 00008006-001C498E2206002E was NULL
    2020-02-07 12:20:44.681 xcodebuild[29722:10555344] [MT] DTDeviceKit: deviceType from 00008006-001C498E2206002E was NULL
    2020-02-07 12:20:44.685 xcodebuild[29722:10555344] [MT] DTDeviceKit: deviceType from 00008006-001C498E2206002E was NULL
    ** BUILD FAILED **



Xcode's output:
↳
    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_SGD", referenced from:
          objc-class-ref in FlutterZsdkPlugin.o
      "_OBJC_CLASS_$_MfiBtPrinterConnection", referenced from:
          objc-class-ref in FlutterZsdkPlugin.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Planning build
    note: Constructing build description

Could not build the precompiled application for the device.

Error launching application on iDevice.

注意 1:此插件使用静态库 zsdk.a 与打印机进行通信。

注意 2:我在 Android Studio 中将 Flutter-zsdk 插件作为一个项目打开,我能够为 Android 和 iOS 构建/运行 example_app,无需任何额外操作……只需打开项目,然后构建并运行一切正常。

所以我的问题是: 构建一个使用插件的项目,而该插件又使用静态 library.a 有什么不同吗?为了能够正确构建/运行这种插件依赖项,我是否必须在我的 iOS 项目配置中进行设置?

【问题讨论】:

    标签: ios flutter dependencies static-libraries flutter-dependencies


    【解决方案1】:

    终于找到了解决办法。 我从 Podfile 中评论了 use_frameworks!,一切正常...

    【讨论】:

      猜你喜欢
      • 2011-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-02
      • 1970-01-01
      • 2021-08-27
      • 2020-11-18
      • 2021-01-22
      相关资源
      最近更新 更多