Flutter NearestMessages多个命令产生Assets.car

时间:2020-10-27 15:21:00

标签: ios swift xcode flutter google-nearby-messages

我为NearestMessages创建了一个新的Flutter项目,并添加了插件:https://github.com/rostopira/flutter_nearby_messages。我尝试了各种方法来更改Podfile或更改Build Phases。

错误:

Multiple commands produce '/Users/mario/Library/Developer/Xcode/DerivedData/Runner-ftkthbvudclotkalukzotjjddtho/Build/Products/Debug-iphonesimulator/Runner.app/Assets.car':
1) Target 'Runner' (project 'Runner') has compile command with input '/Users/mario/Dev/flutter_intranet/ios/Runner/Assets.xcassets' 2) That command depends on command in Target 'Runner' (project 'Runner'): script phase “[CP] Copy Pods Resources”

如果我放:

Legacy Build System

install! 'cocoapods', :disable_input_output_paths => true (on Podfile)

该应用运行,但未加载启动器图标,并加载了默认的Flutter图标

1 个答案:

答案 0 :(得分:0)

我能够重现此问题并将其修复在计算机中。构建存在两个问题。

首先是我的目录结构,我在提交flutter_nearby_messages时克隆了56052e630bcf9ad8947aa8dca0f7caeeb44f12c9,并像这样设置目录:

Repos/
  github.com/
    triztian/
      nearbymsg_sample/ # flutter app
    rostopira/
      flutter_nearby_messages/ # package
     

该版本有2个问题

  1. 伪造Assets.car错误。这是由Runner.xcodeproj包含Assets.xcasset捆绑软件引起的,并且它也被cocoapods脚本包括在内,可以通过从Assets.xcassets中删除Copy Bundle Resources来解决此问题,如图所示在Runner.xcodeproj文件的附件图像中。

Remove Assets.xcassets

  1. module.modulemap软件包(已克隆到我的计算机)中的flutter_nearby_message文件路径出现问题

要修复模块附近的消息包,我对其应用了以下补丁:

--- a/ios/Classes/NearbyMessages/module.modulemap
+++ b/ios/Classes/NearbyMessages/module.modulemap
@@ -5,6 +5,6 @@
  This file lives inside a folder, and that folder is the actual module. In Xcode the SWIFT_INCLUDE_PATHS needs to include the parent directory to that folder.
  */
 module NearbyMessages {
-    header "../../../example/ios/Pods/NearbyMessages/Sources/GNSMessages.h"
+    header "/Users/tristian/Repos/github.com/triztian/nearbymsg_sample/ios/Pods/NearbyMessages/Sources/GNSMessages.h"
     export *
 }

在您的情况下,您必须使用与目录结构匹配的路径,问题是在复制资产文件之后,它找不到GNSMessage.h标头。该软件包已使用2年,建议您使用flutter工具链的更新版本重新创建它,以查看是否可以解决所有这些路径问题。为此,您必须将软件包安装为“本地”软件包,这意味着在我的pubspec.yaml中,我这样指定了软件包:

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  flutter_nearby_messages:
      path: ../../rostopira/flutter_nearby_messages

我建议将其作为tmp的解决方法,但是应该找出一种不使用完整路径的方法。