Repository navigation
multiple_flutters_ios crashes when run on iOS device #1004
Copy link
Copy link
Closed
flutter/flutter
#97689Description
I tried to build and run the multiple_flutters_ios example located in https://github.com/flutter/samples/tree/master/add_to_app/multiple_flutters/multiple_flutters_ios on my iOS device following the instructions given in the readme (using master of flutter @ flutter/flutter@39c5d2f and xcode 13.2.1):
cd ../multiple_flutters_module
flutter pub get
cd -
pod install
open MultipleFluttersIos.xcworkspace
# (build and run)
When running the app with xcode, it crashes with the following error:
Library not loaded: @rpath/App.framework/App
Referenced from: /private/var/containers/Bundle/Application/87326E6C-36A4-4235-B2CA-25AFC260B730/MultipleFluttersIos.app/MultipleFluttersIos
Reason: tried: '/usr/lib/swift/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/87326E6C-36A4-4235-B2CA-25AFC260B730/MultipleFluttersIos.app/Frameworks/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/87326E6C-36A4-4235-B2CA-25AFC260B730/MultipleFluttersIos.app/Frameworks/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/87326E6C-36A4-4235-B2CA-25AFC260B730/MultipleFluttersIos.app/Frameworks/App.framework/App' (no such file), '/usr/lib/swift/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/87326E6C-36A4-4235-B2CA-25AFC260B730/MultipleFluttersIos.app/Frameworks/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/87326E6C-36A4-4235-B2CA-25AFC260B730/MultipleFluttersIos.app/Frameworks/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/87326E6C-36A4-4235-B2CA-25AFC260B730/MultipleFluttersIos.app/Frameworks/App.framework/App' (no such file), '/System/Library/Frameworks/App.framework/App' (no such file)
Looks like the bundle that xcode produces for the app does not include the AOT compiled dart code for the app (App.framework).
flutter doctor -v
[✓] Flutter (Channel master, 2.10.0-1.0.pre.361, on macOS 12.1 21C52 darwin-x64, locale en)
• Flutter version 2.10.0-1.0.pre.361 at /Users/goderbauer/dev/flutter
• Upstream repository [email protected]:goderbauer/flutter.git
• Framework revision 39c5d2fa0a (19 hours ago), 2022-02-01 14:58:27 -0800
• Engine revision 20de5d73c6
• Dart version 2.17.0 (build 2.17.0-69.0.dev)
• DevTools version 2.10.0-dev.1
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/goderbauer/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio with Blaze.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio with Blaze.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
[✓] IntelliJ IDEA Community Edition (version 2021.2.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 62.0.3
• Dart plugin version 212.5632
[✓] Connected device (4 available)
• iPhone (mobile) • 00008020-00013D380C85002E • ios • iOS 15.3 19D50
• iPhone 13 (mobile) • 542027A8-5CC8-403C-8616-F42B689E2362 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 12.1 21C52 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.99
[✓] HTTP Host Availability
• All required HTTP hosts are available
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
goderbauer commentedon Feb 2, 2022
I am not familiar with xcode's embedding of App.framework in this add_to_app context. @jmagman, do you maybe have an idea of what may be going wrong here?
/cc @gaaclarke, who was able to reproduce this problem on his machine.
jmagman commentedon Feb 2, 2022
I just tried it and couldn't reproduce. Can you attach your Xcode build logs from

MultipleFluttersIos.xcworkspace?In my logs the parts that's placing
App.frameworkis:then
Called from:

goderbauer commentedon Feb 2, 2022
The crash only happens when I run on a real device. On a simulator, the app starts up fine, but doesn't work properly. When I hit the "next" button I am presented with a black screen and these logs:
jmagman commentedon Feb 2, 2022
That's what I would expect with the App.framework missing.
It runs for me on a simulator and real device, the Xcode build logs may point to the issue.

goderbauer commentedon Feb 2, 2022
@jmagman See the requested log below.
logs
jmagman commentedon Feb 2, 2022
Can you run
flutter clean && flutter pub getin the module, then try again? Looks like the bad state is cached.goderbauer commentedon Feb 2, 2022
goderbauer commentedon Feb 2, 2022
It has the same lines you posted in #1004 (comment), but it is still crashing for me.
jmagman commentedon Feb 2, 2022
What's the output of:
goderbauer commentedon Feb 2, 2022
jmagman commentedon Feb 2, 2022
I was able to reproduce when I downgraded CocoaPods to 1.10.1.
@goderbauer can you run
sudo gem install cocoapodsto get to 1.11.2 and see if you can still reproduce?goderbauer commentedon Feb 2, 2022
After a clean everything and following the same steps from the readme I am still seeing the same crash.
goderbauer commentedon Feb 2, 2022
Since @redbrogdon pointed out that these samples are only supposed to be runnable against the stable channel, I tried this with the stable channel as well and it is failing there as well.
jmagman commentedon Feb 3, 2022
When I'm on 1.11 in
multiple_flutters_ios/Pods/Target Support Files/Pods-MultipleFluttersIos/Pods-MultipleFluttersIos-frameworks.shI see:However, when I switch to 1.10.2 the
App.frameworkline isn't generated:@gaaclarke is also still reporting the same issue on 1.11. Still investigating...
jmagman commentedon Feb 3, 2022
@goderbauer when you're on 1.11.2, run
pod installand it still reproduces, can you attach that file?jmagman commentedon Feb 3, 2022
Guessing something in here is failing:
https://github.com/flutter/flutter/blob/2df7dca858f3cd05da75f91f596441cc8a5a9b44/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb.tmpl#L104-L113
jmagman commentedon Feb 3, 2022
@goderbauer or @gaaclarke can you try flutter/flutter#97689 ?
gaaclarke commentedon Feb 3, 2022
@jmagman I tried it out, worked for me =)
goderbauer commentedon Feb 3, 2022
I can also confirm that with flutter/flutter#97689 applied everything is working as expected. Thanks for debugging this, @jmagman!
goderbauer commentedon Feb 3, 2022
Probably no longer relevant, but for completeness, here's my
multiple_flutters_ios/Pods/Target Support Files/Pods-MultipleFluttersIos/Pods-MultipleFluttersIos-frameworks.shfile for the crashing case as requested in #1004 (comment):Pods-MultipleFluttersIos-frameworks.sh.zip
As you suspected, it is missing the
App.frameworkline.jmagman commentedon Feb 3, 2022
Yay! That was really tricky to figure out! Now to test it... 🤔
jmagman commentedon Mar 1, 2022
Fixed by flutter/flutter#97689