升级到Flutter 1.17.1后,iOS多环境问题

时间:2020-05-17 01:53:34

标签: ios xcode firebase flutter

自几天前升级到Flutter 1.17.1以来,我一直遇到此错误...我尝试清理项目并切换回Xcode中的Legacy构建系统,但仍然遇到相同的问题。

我的项目一直在使用这种方法来处理多种环境,并且直到几天前我进行升级之前,它一直运行良好。 https://medium.com/@animeshjain/build-flavors-in-flutter-android-and-ios-with-different-firebase-projects-per-flavor-27c5c5dac10b

我们非常感谢您的帮助!

Xcode's output:
↳
    error: Multiple commands produce '/Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist':
    1) Target 'Runner' (project 'Runner') has copy command from '/Users/ivanchau/AndroidStudioProjects/fella/ios/Runner/Firebase/development/GoogleService-Info.plist' to '/Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist'
    2) Target 'Runner' (project 'Runner') has copy command from '/Users/ivanchau/AndroidStudioProjects/fella/ios/Runner/Firebase/production/GoogleService-Info.plist' to '/Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist'

    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: duplicate output file '/Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist' on task: CopyPlistFile /Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist /Users/ivanchau/AndroidStudioProjects/fella/ios/Runner/Firebase/production/GoogleService-Info.plist (in target 'Runner' from project 'Runner')
    warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
    warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-CA)
    • Flutter version 1.17.1 at /Users/ivanchau/Documents/flutter
    • Framework revision f7a6a7906b (4 days ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/ivanchau/Library/Android/sdk
    • Platform android-29, build-tools 28.0.3
    • ANDROID_HOME = /Users/ivanchau/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4.1, Build version 11E503a
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (1 available)
    • iPhone 11 Pro • 357DAB56-8A57-4AB3-A319-0FC1EBCA1515 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

• No issues found!

2 个答案:

答案 0 :(得分:1)

在构建阶段(在Xcode中打开项目/ Runner.xcworkspace。之后),检查名为“复制捆绑资源”的构建阶段,并删除2 * n行,以根据环境复制您的GoogleService-info.plist。

这假设您有一个自定义脚本,该脚本将根据风味/方案复制正确的文件。

答案 1 :(得分:0)

我正在针对不同的口味使用类似的方法。升级到Flutter 1.17.1和xcode 11.5后,我可以为Android构建但不能为iOS构建

错误提示您有重复项。您是否使用了以下命令?

flutter run --flavor yourflavor