Skip to content

Crash on archived iOS ipa with bitcode enabled (App Store install), Library not loaded: ./libFlutter.dylib #42458

@arctouch-matheusromao

Description

@arctouch-matheusromao

Hey guys,

Here at ArcTouch, we are exploring the Flutter modules and all its power. We were able to integrate a module on both Android and iOS and it works great on debug. However, when we release a build on our Jenkins, we get an error when the app is opened.

We know the "add-to-app" support is still in preview, but we created a release build for Android and it worked, but it doesn't work for iOS, with the following error:

Termination Description: DYLD, Library not loaded: ./libFlutter.dylib | Referenced from: /var/containers/Bundle/Application/FC2EB865-A3C1-45F6-86AE-186D59120D73/example_ios.app/example_ios | Reason: image not found

Steps to Reproduce

  1. Create a flutter module (we used example_module for the project name)
  2. Create a new iOS project on xcode (we used example_ios)
    1. We are using xcode 11, so we deleted SceneDelegate.swift.
  3. Run pod init in example_ios
  4. Add the following to the generated Podfile:
flutter_application_path = '../example_module/'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'example_ios' do
  use_frameworks!

  # Pods for example_ios
  install_all_flutter_pods(flutter_application_path)
end
  1. Run pod install
  2. Follow the add-to-app tutorial and make the changes to import the module
  3. Sign your iOS native project
  4. Try to create a release build of the iOS app

Target Platform: iOS
Target OS version/browser: 11.0+
Devices: Any

Logs

Jenkins build

+ flutter channel master
Downloading Dart SDK from Flutter engine b863200c37df4ed378042de11c4e9ff34e4e58c9...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  3  263M    3 9152k    0     0  14.3M      0  0:00:18 --:--:--  0:00:18 14.3M
 27  263M   27 73.0M    0     0  44.9M      0  0:00:05  0:00:01  0:00:04 44.9M
 49  263M   49  131M    0     0  50.1M      0  0:00:05  0:00:02  0:00:03 50.1M
 69  263M   69  183M    0     0  50.6M      0  0:00:05  0:00:03  0:00:02 50.6M
 96  263M   96  253M    0     0  54.9M      0  0:00:04  0:00:04 --:--:-- 54.9M
100  263M  100  263M    0     0  55.3M      0  0:00:04  0:00:04 --:--:-- 61.4M
Building flutter tool...
Switching to flutter channel 'master'...
git: Switched to branch 'master'
git: Your branch is behind 'origin/master' by 30 commits, and can be fast-forwarded.
git:   (use "git pull" to update your local branch)
+ cd example_module
+ rm -rf '/Users/arctouch/Jenkins/workspace/Flutter-Poc/archive/*'
+ rm -rf '/Users/arctouch/Jenkins/workspace/Flutter-Poc/publish/*'
+ rm -rf '/Users/arctouch/Jenkins/workspace/Flutter-Poc/output/Publish/*'
+ /usr/local/bin/flutter/bin/flutter build ios --release --build-number 1.0.0.22 --build-name=22
Downloading Dart SDK from Flutter engine 0d749933bcc63b53771e37e6cc28fa43c3d1fd06...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  7  259M    7 20.6M    0     0  19.9M      0  0:00:13  0:00:01  0:00:12 19.9M
 29  259M   29 76.6M    0     0  37.6M      0  0:00:06  0:00:02  0:00:04 37.6M
 49  259M   49  128M    0     0  41.0M      0  0:00:06  0:00:03  0:00:03 41.0M
 71  259M   71  184M    0     0  44.9M      0  0:00:05  0:00:04  0:00:01 44.9M
 92  259M   92  240M    0     0  46.3M      0  0:00:05  0:00:05 --:--:-- 46.7M
100  259M  100  259M    0     0  47.9M      0  0:00:05  0:00:05 --:--:-- 54.5M
Building flutter tool...
Running "flutter pub get" in example_module...                      2.6s
Building com.arctouch.exampleModule for device (ios-release)...
Signing iOS app for device deployment using developer identity: "#######"
Running Xcode build...                                          
Xcode build done.                                           225.5s
Built /Users/arctouch/Jenkins/workspace/Flutter-Poc/example_module/build/ios/iphoneos/Runner.app.
[Flutter-Poc] $ /bin/sh -xe /var/folders/dp/1ztzp1p136j_2rfv57gj5hc00000gn/T/jenkins3641580055811886166.sh
+ cd example_ios
+ pod install
Analyzing dependencies
Downloading dependencies
Installing Flutter (1.0.0)
Installing FlutterPluginRegistrant (0.0.1)
Installing example_module (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 3 dependencies from the Podfile and 3 total pods installed.
[iphone] $ ant -file buildscript.xml -DARCHIVE_EXPORT_METHOD=enterprise -DSCHEME=example_ios -DEXPORT_BUNDLE_IDENTIFIER=com.arctouch.example-ios -DOUTPUT_FOLDER=../../output -DSHARED_FOLDER=. -DPLIST_FILE=example_ios/Info.plist -DPUBLISH_FOLDER=../../publish -DXCODE_WORKSPACE=example_ios -DCONFIGURATION=Release -DCUSTOM_PRODUCT_NAME=example_ios -DBUNDLE_VERSION=1.0.0 -DPROJECT_BASE_PATH=../../example_ios -DSDK_NAME=iphoneos -DBUILD_NAME=Example-iOS -DBUILD_IS_DELIVERABLE=yes -DRUN_COCOAPODS=no -v PROCESS_DEVICE_ARCHIVE
[...]
[exec] ** ARCHIVE SUCCEEDED **
[...]
BUILD SUCCESSFUL
Total time: 5 minutes 54 seconds

flutter doctor -v

[✓] Flutter (Channel master, v1.10.15-pre.23, on Mac OS X 10.14.6 18G95, locale en-US)
    • Flutter version 1.10.15-pre.23 at /usr/local/bin/flutter
    • Framework revision 440753bae8 (2 days ago), 2019-10-08 21:33:17 -0700
    • Engine revision 0d749933bc
    • Dart version 2.6.0 (build 2.6.0-dev.0.0 f4a72bfc64)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/arctouch/Library/Android/sdk
    • Android NDK at /Users/arctouch/Library/Android/sdk/ndk-bundle
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /Users/arctouch/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version openjdk version "1.8.0_112-release"
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

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

[!] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version openjdk version "1.8.0_112-release"

[!] Connected device
    ! No devices available

Crash report:

{"app_name":"example_ios","timestamp":"2019-10-10 12:10:26.70 -0300","app_version":"1.0.0","slice_uuid":"210cb836-83ac-3a03-98b7-c650940fc768","adam_id":0,"build_version":"1.0.0.21","bundleID":"com.arctouch.example-ios","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 11.0.3 (15A432)","incident_id":"7B238C33-2F71-4ECE-8741-88DF5BCDA3C4","name":"example_ios"}
Incident Identifier: 7B238C33-2F71-4ECE-8741-88DF5BCDA3C4
CrashReporter Key:   35c317441e6ef221e78ee758e85eb6cf02331dc8
Hardware Model:      iPhone9,4
Process:             example_ios [566]
Path:                /private/var/containers/Bundle/Application/FC2EB865-A3C1-45F6-86AE-186D59120D73/example_ios.app/example_ios
Identifier:          com.arctouch.example-ios
Version:             1.0.0.21 (1.0.0)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.arctouch.example-ios [970]


Date/Time:           2019-10-10 12:10:26.6692 -0300
Launch Time:         2019-10-10 12:10:26.6366 -0300
OS Version:          iPhone OS 11.0.3 (15A432)
Baseband Version:    2.00.01
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Description: DYLD, Library not loaded: ./libFlutter.dylib | Referenced from: /var/containers/Bundle/Application/FC2EB865-A3C1-45F6-86AE-186D59120D73/example_ios.app/example_ios | Reason: image not found
Triggered by Thread:  0

Filtered syslog:
None found

Thread 0 Crashed:
0   dyld                          	0x0000000102a72f1c 0x102a44000 + 192284
1   dyld                          	0x0000000102a726f4 0x102a44000 + 190196
2   dyld                          	0x0000000102a72720 0x102a44000 + 190240
3   dyld                          	0x0000000102a48498 0x102a44000 + 17560
4   dyld                          	0x0000000102a4b714 0x102a44000 + 30484
5   dyld                          	0x0000000102a4521c 0x102a44000 + 4636

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000006   x1: 0x0000000000000001   x2: 0x000000016d526510   x3: 0x000000000000008b
    x4: 0x000000016d526110   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0x0000000000000a90
    x8: 0x0000000000000020   x9: 0x0000000000000009  x10: 0x203a6e6f73616552  x11: 0x6f6e206567616d69
   x12: 0x20200a736f695f65  x13: 0x203a6e6f73616552  x14: 0x6f6e206567616d69  x15: 0x00646e756f662074
   x16: 0x0000000000000209  x17: 0x000000008000001f  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x000000016d526110  x21: 0x000000000000008b  x22: 0x000000016d526510  x23: 0x0000000000000001
   x24: 0x0000000000000006  x25: 0x00000001028d8000  x26: 0x0000000102a86000  x27: 0x0000000102a85f88
   x28: 0x000000016d527b10   fp: 0x000000016d5260e0   lr: 0x0000000102a726f4
    sp: 0x000000016d5260a0   pc: 0x0000000102a72f1c cpsr: 0x00000000

Binary Images:
0x1028d8000 - 0x1028dffff example_ios arm64  <210cb83683ac3a0398b7c650940fc768> /var/containers/Bundle/Application/FC2EB865-A3C1-45F6-86AE-186D59120D73/example_ios.app/example_ios
0x102a44000 - 0x102a83fff dyld arm64  <113803ec7f6936e6b06abef57a8755fd> /usr/lib/dyld
0x102ae0000 - 0x102f7bfff App arm64  <b82a0cc1ddaa31e5b3567424f064f135> /var/containers/Bundle/Application/FC2EB865-A3C1-45F6-86AE-186D59120D73/example_ios.app/Frameworks/App.framework/App

EOF

DEMO

Debug

Release

Note

We don't know if it's necessary to build the module before building the iOS app. We are just not sure how to change the build variant for the Flutter module and even if we have to change at all. We tried to build only the module (without integrating) to create an iOS app in release and it worked. That's why we are building the module before building the app. We tried first without building the module, but we were getting the same error.

Metadata

Metadata

Assignees

Labels

a: existing-appsIntegration with existing apps via the add-to-app flowc: crashStack traces logged to the consoleengineflutter/engine related. See also e: labels.platform-iosiOS applications specificallyt: xcode"xcodebuild" on iOS and general Xcode project managementtoolAffects the "flutter" command-line tool. See also t: labels.waiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions