Xcode build step fails for Flutter module add to app

Bitrise Build Issue Report template

Description of the issue

I am attempting to get a primary and deploy workflow going for an iOS app using the flutter add-to-app process. This process differs from the normal Flutter project setup in that you create a Flutter module (instead of a normal Flutter project) which then gets added to an existing iOS project.

Our project structure contains two top level directories- one for the stand-alone Flutter module and one for the add-to-app iOS project. Currently, we are attempting to have our primary workflow run the Flutter Test step on the Flutter module and the Xcode Test step on the add-to-app Xcode project. We’ve pointed both of these steps to their respective directories.

It fails on the Xcode test step with a compiler error related to the FlutterEngine

I’ve also tried the deploy workflow by running the Xcode Archive and Export step (instead of the Xcode Test step). This also fails with an error saying the Flutter framework does not contain bitcode.

Environment:

Xcode 11.3.x, on MacOS 10.14.6 Mojave

Which build Step causes the issue and which version of the step?

Xcode Test for iOS
Xcode Archive and Export for iOS

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : Immediately

Local reproduction

Can it be reproduced on your own Mac/PC by following our local debug guide? Please follow at least the first section (“Testing with a full clean git clone”) to make sure to test the state of the code what bitrise.io will get when it does a git clone in the clean environment! If possible please note which sections you tried.

Not reproducible locally after doing a clean git clone

Local reproduction: Linux / Android (docker based) stack builds

Can it be reproduced by running the build locally, after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( Bitrise CLI )? If no, can it be reproduced with Docker (using the same docker images / environment we use on bitrise.io)? Related guide: Redirecting… .

Have not tested with Bitrise CLI

Build log

Sending full logs in via email

Partial log:

{{{
    Successful Steps:
    - activate-ssh-key
    - git-clone
    - Do anything with Script step
    - flutter-installer
    - flutter-analyze
    - flutter-test
    - certificate-and-profile-installer
    - recreate-user-schemes
    - flutter-build
    - cocoapods-install
}}}
+------------------------------------------------------------------------------+
| (10) xcode-test                                                              |
+------------------------------------------------------------------------------+
| id: xcode-test                                                               |
| version: 2.4.3                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2020-01-14T23:25:36Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
INFO[23:25:36]  * [OK] Step dependency (xcode) installed, available. 
INFO[23:25:36]  * [OK] Step dependency (go) installed, available. 
Configs:
- ProjectPath: EmbedFlutterModuleTest/EmbedFlutterModuleTest.xcworkspace
- Scheme: EmbedFlutterModuleTest
- SimulatorPlatform: iOS Simulator
- SimulatorDevice: iPhone 11 Pro Max
- SimulatorOsVersion: latest
- OutputTool: xcpretty
- IsCleanBuild: false
- IsSingleBuild: true
- ShouldBuildBeforeTest: true
- ShouldRetryTestOnFail: false
- GenerateCodeCoverageFiles: false
- ExportUITestArtifacts: false
- DisableIndexWhileBuilding: true
- TestOptions: 
- XcprettyTestOptions: --color --report html --output "/Users/vagrant/deploy/xcode-test-results-Runner.html"
- Verbose: false
- HeadlessMode: true
- CacheLevel: swift_packages
* action: -workspace
- xcodebuildVersion: Xcode 11.3.1 (Build version 11C504)
Checking if output tool (xcpretty) is installed
- xcprettyVersion: 0.3.0
Simulator infos
* simulator_name: iPhone 11 Pro Max, version: iOS 13.3, UDID: 62DE4985-B3DD-4687-A0B1-30FD9C06B753, status: Shutdown
* device_destination: id=62DE4985-B3DD-4687-A0B1-30FD9C06B753
Running the tests...
$ set -o pipefail && env "NSUnbufferedIO=YES" xcodebuild "-workspace" "/Users/vagrant/git/EmbedFlutterModuleTest/EmbedFlutterModuleTest.xcworkspace" "-scheme" "EmbedFlutterModuleTest" "build" "COMPILER_INDEX_STORE_ENABLE=NO" "test" "-destination" "id=62DE4985-B3DD-4687-A0B1-30FD9C06B753" "-resultBundlePath" "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/XCUITestOutput797995325/Test.xcresult" [REDACTED] xcpretty "--color" "--report" "html" "--output" "/Users/vagrant/deploy/xcode-test-results-Runner.html"
â–¸ Processing FlutterPluginRegistrant-Info.plist
â–¸ Copying GeneratedPluginRegistrant.h
â–¸ Copying FlutterPluginRegistrant-umbrella.h
â–¸ Compiling GeneratedPluginRegistrant.m
â–¸ Compiling FlutterPluginRegistrant-dummy.m
â–¸ Compiling FlutterPluginRegistrant_vers.c
â–¸ Compiling NotificationController.swift
â–¸ Compiling ExtensionDelegate.swift
â–¸ Compiling InterfaceController.swift
â–¸ Linking FlutterPluginRegistrant
â–¸ Touching FlutterPluginRegistrant.framework (in target 'FlutterPluginRegistrant' from project 'Pods')
â–¸ Processing Pods-EmbedFlutterModuleTest-Info.plist
â–¸ Copying Pods-EmbedFlutterModuleTest-umbrella.h
â–¸ Compiling Pods-EmbedFlutterModuleTest-dummy.m
â–¸ Compiling Pods_EmbedFlutterModuleTest_vers.c
â–¸ Touching Pods_EmbedFlutterModuleTest.framework (in target 'Pods-EmbedFlutterModuleTest' from project 'Pods')
â–¸ Linking EmbededFlutter\
â–¸ Processing Info.plist
â–¸ Touching EmbededFlutter\ Extension.appex (in target 'EmbededFlutter Extension' from project 'EmbedFlutterModuleTest')
â–¸ Compiling Interface.storyboard
â–¸ Processing Info.plist
â–¸ Copying /Users/vagrant/Library/Developer/Xcode/DerivedData/EmbedFlutterModuleTest-flaffbfrrgodqhhabkizedipnons/Build/Products/Debug-watchsimulator/EmbededFlutter\ Extension.appex
â–¸ Touching EmbededFlutter.app (in target 'EmbededFlutter' from project 'EmbedFlutterModuleTest')
â–¸ Running script '[CP] Check Pods Manifest.lock'
â–¸ Running script '[CP-User] Run Flutter Build Script'
â–¸ Compiling ViewController.swift
â–¸ Compiling AppDelegate.swift
❌  /Users/vagrant/git/EmbedFlutterModuleTest/EmbedFlutterModuleTest/AppDelegate.swift:16:30: cannot invoke initializer for type 'FlutterEngine' with an argument list of type '(name: String)'
    lazy var flutterEngine = FlutterEngine(name: "Flutter Engine")
                             ^
â–¸ Compiling SceneDelegate.swift
❌  /Users/vagrant/git/EmbedFlutterModuleTest/EmbedFlutterModuleTest/AppDelegate.swift:16:30: cannot invoke initializer for type 'FlutterEngine' with an argument list of type '(name: String)'
    lazy var flutterEngine = FlutterEngine(name: "Flutter Engine")
                             ^
â–¸ Linking EmbededFlutter\
â–¸ Copying GeneratedPluginRegistrant.h
â–¸ Compiling GeneratedPluginRegistrant.m
â–¸ Copying /Users/vagrant/Library/Developer/Xcode/DerivedData/EmbedFlutterModuleTest-flaffbfrrgodqhhabkizedipnons/Build/Products/Debug-watchsimulator/EmbededFlutter\ Extension.appex
â–¸ Linking FlutterPluginRegistrant
â–¸ Processing Pods-EmbedFlutterModuleTest-EmbedFlutterModuleTestUITests-Info.plist
â–¸ Copying Pods-EmbedFlutterModuleTest-EmbedFlutterModuleTestUITests-umbrella.h
â–¸ Running script '[CP-User] Run Flutter Build Script'
â–¸ Compiling Pods-EmbedFlutterModuleTest-EmbedFlutterModuleTestUITests-dummy.m
â–¸ Compiling Pods_EmbedFlutterModuleTest_EmbedFlutterModuleTestUITests_vers.c
â–¸ Processing Pods-EmbedFlutterModuleTestTests-Info.plist
â–¸ Copying Pods-EmbedFlutterModuleTestTests-umbrella.h
â–¸ Compiling Pods_EmbedFlutterModuleTestTests_vers.c
â–¸ Compiling Pods-EmbedFlutterModuleTestTests-dummy.m
â–¸ Touching Pods_EmbedFlutterModuleTest_EmbedFlutterModuleTestUITests.framework (in target 'Pods-EmbedFlutterModuleTest-EmbedFlutterModuleTestUITests' from project 'Pods')
â–¸ Touching Pods_EmbedFlutterModuleTestTests.framework (in target 'Pods-EmbedFlutterModuleTestTests' from project 'Pods')
â–¸ Compiling ViewController.swift
â–¸ Compiling AppDelegate.swift
❌  /Users/vagrant/git/EmbedFlutterModuleTest/EmbedFlutterModuleTest/AppDelegate.swift:16:30: cannot invoke initializer for type 'FlutterEngine' with an argument list of type '(name: String)'
    lazy var flutterEngine = FlutterEngine(name: "Flutter Engine")
                             ^
â–¸ Compiling SceneDelegate.swift
❌  /Users/vagrant/git/EmbedFlutterModuleTest/EmbedFlutterModuleTest/AppDelegate.swift:16:30: cannot invoke initializer for type 'FlutterEngine' with an argument list of type '(name: String)'
    lazy var flutterEngine = FlutterEngine(name: "Flutter Engine")
                             ^
Exporting test results
$ cp "-a" "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/XCUITestOutput797995325/Test.xcresult" "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/test_results606383812/test_result994406650/EmbedFlutterModuleTest/"
xcode test exit code: 65
xcode test failed, error: exit status 65
Last lines of the Xcode's build log:
    Testing cancelled because the build failed.
** TEST FAILED **
The following build commands failed:
    CompileSwift normal x86_64 /Users/vagrant/git/EmbedFlutterModuleTest/EmbedFlutterModuleTest/AppDelegate.swift
    CompileSwift normal x86_64 /Users/vagrant/git/EmbedFlutterModuleTest/EmbedFlutterModuleTest/SceneDelegate.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(3 failures)
If you can't find the reason of the error in the log, please check the raw-xcodebuild-output.log
The log file is stored in $BITRISE_DEPLOY_DIR, and its full path
is available in the $BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH environment variable.
You can check the full, unfiltered and unformatted Xcode output in the file:
/Users/vagrant/deploy/raw-xcodebuild-output.log
If you have the Deploy to Bitrise.io step (after this step),
that will attach the file to your build as an artifact!
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | xcode-test (exit code: 1)                                     | 1.1 min  |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-steplib/steps-xcode-test/issues    |
| Source: https://github.com/bitrise-steplib/steps-xcode-test                  |
+---+---------------------------------------------------------------+----------+
{{{
    Steps that haven't been run after failed Xcode Step:
    - deploy-to-bitrise-io
}}}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.