美文网首页1
Flutter 运行报错问题

Flutter 运行报错问题

作者: Superman168 | 来源:发表于2021-10-19 15:49 被阅读0次

问题如下:

终端中的报错信息:

The Swift pod amap_special depends upon MJExtension, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

The Swift pod barcode_scan depends upon MTBBarcodeScanner, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

image.png

Android Studio 中的报错信息:
Command CompileSwift failed with a nonzero exit code

<unknown>:0: error: could not build Objective-C module 'amap_special'

image.png

一堆这个报错:

image.png

<unknown>:0: error: could not build Objective-C module 'amap_special' note: Using new build system note: Building targets in parallel note: Planning build note: Using build description from disk

image.png

在Flutter项目中导入了二维码扫描包 和 amap_special 地图

  # 扫码
  barcode_scan: ^3.0.1

然后在Android端和web是没有问题的,但是在iOS运行就会报上面的错误,既然是外接包方面的那就是pods上面的问题了,网上百度了很多,但是没能解决问题,也有讲OC项目和Swift语言版本的问题,后来也一直以为是语言的问题呢,还有pod clean 再install的,更改Build Setting设置的,各种方式,尝试了一遍也没解决,

我看网上还有说下面barcode_scan这个报错的,在profile 文件中添加 use_frameworks!然后pod install,是的,这样可以解决这个问题,但是地图的依然报错:

image.png

直到今天下午再一位热心同事的帮助下才解决了问题,说到底其实很简单,下面的报错信息已经提示的很明白了,奈何不好好的仔细研究,混乱一通的百度,事倍功无。

不想看上面踩坑历程的,直接看这里:

解决方法:

只需要这样:

#use_frameworks!
use_modular_headers!

明白了吧?So easy!运行OK,折磨半天的问题终于解决了,特此记录一下,给踩坑的小伙伴做个参考。

相关文章

网友评论

    本文标题:Flutter 运行报错问题

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