Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter build ios failing: ld: framework not found App #32454

Closed
kentcb opened this issue May 10, 2019 · 34 comments · Fixed by #51453
Closed

flutter build ios failing: ld: framework not found App #32454

kentcb opened this issue May 10, 2019 · 34 comments · Fixed by #51453
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@kentcb
Copy link
Contributor

kentcb commented May 10, 2019

Steps to Reproduce

I am running:

flutter build ios --release

Until recently, this worked. However, something is now broken and I'm having trouble identifying what. I have been trying to get Crashlytics working and I suspect it is related but it's unclear how.

Logs

I have run a build with --verbose and have uploaded as a zip here (output was too much for gist). I have redacted only the application name from the log.

This appears at several points in the log:

ld: framework not found App

But I suspect there is an underlying problem causing that.

flutter doctor -v output:

[✓] Flutter (Channel master, v1.5.9-pre.196, on Mac OS X 10.14.4 18E226, locale en-AU)
    • Flutter version 1.5.9-pre.196 at /Users/kent/Repository/flutter
    • Framework revision 9c77e8e8a0 (6 hours ago), 2019-05-09 12:43:51 -0700
    • Engine revision 644db5a49c
    • Dart version 2.3.1 (build 2.3.1-dev.0.0 a0290f823c)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/kent/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[!] Android Studio (version 3.4)
    • 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 Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] VS Code (version 1.33.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.0.0

[✓] Connected device (1 available)
    • iPad • e9621f25ae14a6b0a4ad7d3eb0600bd2454564c0 • ios • iOS 12.1.4

! Doctor found issues in 1 category.

If you're wondering why I'm on master, it's because I've been going through hell trying to get an iOS build to actually complete without hanging/timeouts. That is now fixed on master so I'm there reluctantly until it makes its way into dev and beyond.

@kentcb
Copy link
Contributor Author

kentcb commented May 10, 2019

I tried going back to dev channel and got same result.

@justinmc justinmc added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels May 10, 2019
@FlorinMihalache
Copy link

I think I had the same issue, also getting this error: ld: framework not found App

This is how I fixed it:
I noticed that in the project/ios/Flutter folder, App.framework was missing. Not sure what caused this, but I'm sure I did't delete it on purpose. I copied it from a new Flutter project and it works fine now.

@kangwang1988
Copy link
Contributor

@FlorinMihalache
Can you run flutter build ios --release --verbose and paste the result here?

@kangwang1988 kangwang1988 added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 12, 2019
@suesitran
Copy link

suesitran commented May 18, 2019

found this when i run "flutter build ios --release --verbose"

Encountered error while building for device.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:24:3)
#1      BuildIOSCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:94:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:559:18)
#3      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:77:64)
#4      _rootRunUnary (dart:async/zone.dart:1132:38)
#5      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#6      _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#7      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#8      Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#9      Future._complete (dart:async/future_impl.dart:473:7)
#10     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#11     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async-patch/async_patch.dart:33:20)
#12     _rootRun (dart:async/zone.dart:1124:13)
#13     _CustomZone.run (dart:async/zone.dart:1021:19)
#14     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#15     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#16     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#17     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)

@kangwang1988
Copy link
Contributor

Let me make the flutter build logic more clear.
1.flutter tools would generate a Generated.xcconfig containing the flutter environment:
image
2.There is a xcode_backend.sh specified in Xcode project's build phases. It would do two things, copy Flutter.framework and compile App.framework based on environment variables specified in Generated.xcconfig
image
3.App.framework and flutter.framework are added to the project by default.
image
4.After adding to the project, it's linked and embeded.
image
This issue probably could be fixed by comparing your project setting and logic given below.

@kentcb

@kangwang1988 kangwang1988 added waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels May 26, 2019
@IvanBean
Copy link

IvanBean commented May 26, 2019

In my case, implementing Crashlytics 0.0.4+3 cause the Flutter.framwork and App.framework not be generated on flutter build ios, the build will fail and after that flutter run resulting in ld: framework not found App.

@harsha973
Copy link

I faced the same issue. For me it's because of wrong crashlytics configuration in Build scripts.

⛔️ Wrong configuration - Having Fabric and xcode_backend.sh in the same build script.

Screen Shot 2019-06-24 at 10 25 41 AM

To fix this, as mentioned in firebase_crashlytics documentation, you need to create separate config for crashlytics separate from Flutter build script.

✔️ 1) Separate config for xcode_backend.sh. Good explanation above. Basically this is responsible to copy Flutter.framework and compile App.framework based on environment variables.

Screen Shot 2019-06-24 at 10 30 29 AM

✔️ 2) Separate config for Pods/Fabric

Screen Shot 2019-06-24 at 10 30 37 AM

In my case the reason for the problem is, xcode_backend.sh is adding input files as arguments and this script fails to copy Flutter.framework

Hope this helps to move you in right direction.

@no-response
Copy link

no-response bot commented Jun 23, 2019

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

@no-response no-response bot closed this as completed Jun 23, 2019
@tudor07
Copy link

tudor07 commented Sep 2, 2019

Still having this issue on Flutter 1.7.8+hotfix.4, but only for iOS 9 and 10. On iOS 12 it works.

@Gioxxy
Copy link

Gioxxy commented Oct 27, 2019

I am having the same problem on flutter 1.9.1+hotfix.6. The files in the .ios folder are not copied to the ios/Flutter folder when I run flutter build ios

@kazuooooo
Copy link

I also having same error and It looks xcode_backend.sh script not executed,
cuz echo "xcode_backend.sh executed! :)" not found, but I couldn't find why.

Runner_xcodeproj

Like @FlorinMihalache say above, I create sample project

flutter create sample_app

and copied App.framework and Flutter.framework to developing app which causing error.

Flutter_と_Flutter_と_github_com_と_最近使った項目_と_Flutter_と_最近使った項目_と_App_framework_と_ios_と_Runner_xcodeproj

It works fine. (but little bit dirty way 👿 )

@Gioxxy
Copy link

Gioxxy commented Oct 28, 2019

I also having same error and It looks xcode_backend.sh script not executed,
cuz echo "xcode_backend.sh executed! :)" not found, but I couldn't find why.

Runner_xcodeproj

Like @FlorinMihalache say above, I create sample project

flutter create sample_app

and copied App.framework and Flutter.framework to developing app which causing error.

Flutter_と_Flutter_と_github_com_と_最近使った項目_と_Flutter_と_最近使った項目_と_App_framework_と_ios_と_Runner_xcodeproj

It works fine. (but little bit dirty way 👿 )

By copying App.framework and Flutter.framework it happens that they are not updated in the following compilations, except in hot reload

@BondarenkoStas BondarenkoStas removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 28, 2019
@jmagman
Copy link
Member

jmagman commented Oct 28, 2019

I am having the same problem on flutter 1.9.1+hotfix.6. The files in the .ios folder are not copied to the ios/Flutter folder when I run flutter build ios

If you are trying the experimental add-to-app feature (the only case there should be an .ios directory) you must be on the master channel. flutter build ios will not copy anything from .ios to ios. In fact, with add-to-app you should not have an ios directory unless you ran make-host-app-editable at some point.
@Gioxxy can you file a new issue? App.framework is injected differently with add-to-app and requires separate triage.

@Gioxxy
Copy link

Gioxxy commented Oct 28, 2019

I am having the same problem on flutter 1.9.1+hotfix.6. The files in the .ios folder are not copied to the ios/Flutter folder when I run flutter build ios

If you are trying the experimental add-to-app feature (the only case there should be an .ios directory) you must be on the master channel. flutter build ios will not copy anything from .ios to ios. In fact, with add-to-app you should not have an ios directory unless you ran make-host-app-editable at some point.
@Gioxxy can you file a new issue? App.framework is injected differently with add-to-app and requires separate triage.

No, I'm not using the add-to-app feature. I'm sorry, doing some tests I noticed that copying the App.framework of the .ios folder in the ios/Flutter folder allows me to compile "correctly",
but it didn't seem like a great solution.

@Gioxxy
Copy link

Gioxxy commented Nov 2, 2019

I opened a new issue here #44050

@Xingefb
Copy link

Xingefb commented Nov 21, 2019

flutter channel other origin ,you will fit it

@u2633
Copy link

u2633 commented Dec 16, 2019

After experiencing many times of failure, I at last solved this issue by a dirty way. First, I created a new project from Android Studio. Next, I copied my source code into the new project including third party Libs. Last, run the command "flutter build ios --release" and launched archive under XCode. This time..., I eventually got the build success message. Hope this helps.

@VikasJilla
Copy link

As @harsha973 mentioned I had to separate the Crashlytics script. But itself did not solve the issue.
Moving the run script to the top of the build phases(I think, mainly to step above embed frameworks) and also keeping the Crashlytics script as the last phase(as mentioned in Crashlytics integration), solved the issue.

Please check the below image
Screen Shot 2020-01-06 at 10 38 12 AM

@jmagman jmagman added this to Awaiting triage in Tools - iOS review Jan 10, 2020
@TahaTesser TahaTesser added the customer: crowd Affects or could affect many people, though not necessarily a specific customer. label Feb 12, 2020
@simphiwehlabisa
Copy link

Create a new flutter project and go to ios folder flutter and copy app.framework to your project

@gian-almada
Copy link

gian-almada commented Mar 3, 2020

I think I had the same issue, also getting this error: ld: framework not found App

This is how I fixed it:
I noticed that in the project/ios/Flutter folder, App.framework was missing. Not sure what caused this, but I'm sure I did't delete it on purpose. I copied it from a new Flutter project and it works fine now.

Let me make the flutter build logic more clear.
1.flutter tools would generate a Generated.xcconfig containing the flutter environment:
image
2.There is a xcode_backend.sh specified in Xcode project's build phases. It would do two things, copy Flutter.framework and compile App.framework based on environment variables specified in Generated.xcconfig
image
3.App.framework and flutter.framework are added to the project by default.
image
4.After adding to the project, it's linked and embeded.
image
This issue probably could be fixed by comparing your project setting and logic given below.

@kentcb

Step 3 App.framework not added to my ios/flutter, i dont why, i tried to make another new project but still not found App.framework, is my flutter crash or something is error??

Tools - iOS review automation moved this from Awaiting triage to Engineer reviewed Mar 3, 2020
@softmarshmallow
Copy link

app, flutter .framework does not exists in newly created dummy project via flutter create sample... wierd..?

@jmagman
Copy link
Member

jmagman commented Mar 30, 2020

app, flutter .framework does not exists in newly created dummy project via flutter create sample... wierd..?

The file won't exist until you run flutter run or flutter build ios. If you're saying that it's not linked and embedded in the Xcode project, then that's behaving correctly, that's what #51453 did.

@palexs
Copy link

palexs commented Apr 12, 2020

My app was missing App.framework and Flutter.framework and as a result failing to start, because Thin Binary build step contained a mistake. According to https://flutter.dev/docs/development/ios-project-migration it should be:

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" thin

but in my case it was:

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed_and_thin

Apparently, xcode_backend.sh on channel stable as of the time of writing this is missing embed_and_thin command. Other channels have it, so I was able to run the app on channel beta, for example.

@jmagman
Copy link
Member

jmagman commented Apr 13, 2020

My app was missing App.framework and Flutter.framework and as a result failing to start, because Thin Binary build step contained a mistake. According to https://flutter.dev/docs/development/ios-project-migration it should be:

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" thin

but in my case it was:

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed_and_thin

Apparently, xcode_backend.sh on channel stable as of the time of writing this is missing embed_and_thin command. Other channels have it, so I was able to run the app on channel beta, for example.

That's exactly right, good investigation. In order to backport from beta/dev/master back to stable, you must have embed and thin separately because embed_and_thin isn't present in stable yet. Most users stay on stable or at least on a particular channel, so we optimize for their use cases, and try to document workarounds for the channel-hoppers.

@palexs
Copy link

palexs commented Apr 13, 2020

@jmagman Thanks, Jenn! I'm afraid many people experiencing the problem land in #49504, but I couldn't post this solution there, as the conversation was resolved there and limited to collaborators only. Maybe you could post there.

@jmagman
Copy link
Member

jmagman commented Apr 13, 2020

@palexs I was hoping "If you are seeing a similar crash on iOS 13.4 or greater, please file a new Flutter GitHub issue so we can take a look." would cover it since there are about a thousand ways for code signing to fail or for the App.framework to be missing, so I don't want to point out #52084 (comment) specifically.

@srjmalla
Copy link

This fixed the issue for me

flutter channel stable

flutter upgrade

@Sauraus
Copy link

Sauraus commented Aug 6, 2020

We just upgrade to 1.20.0 and since then this issue has cropped up. Tried all options so far and nothing.

Another fun fact, downgrading to 1.19.0-4.3.pre resolves the issue, no more framework not found App... got a love software that makes breaking changes on a minor release.... Semantic versioning anyone? :D https://semver.org/

@rubensdemelo
Copy link
Contributor

We just upgrade to 1.20.0 and since then this issue has cropped up. Tried all options so far and nothing.

Another fun fact, downgrading to 1.19.0-4.3.pre resolves the issue, no more framework not found App... got a love software that makes breaking changes on a minor release.... Semantic versioning anyone? :D https://semver.org/

try to delete ios/Flutter/Flutter.framework/ and run again

@Sauraus
Copy link

Sauraus commented Aug 6, 2020

We just upgrade to 1.20.0 and since then this issue has cropped up. Tried all options so far and nothing.
Another fun fact, downgrading to 1.19.0-4.3.pre resolves the issue, no more framework not found App... got a love software that makes breaking changes on a minor release.... Semantic versioning anyone? :D https://semver.org/

try to delete ios/Flutter/Flutter.framework/ and run again

Our build process runs a flutter clean which wipes all intermediate directories so that's already being done.

BTW. I can also build the app with 1.17.5 except for some svg issues which is why I need the 1.19.0-4.3.pre version.

@jmagman
Copy link
Member

jmagman commented Aug 6, 2020

flutter clean does not delete ios/Flutter/Flutter.framework.

If you are seeing this problem, please file a new GitHub issue and completely fill out the template, and include the output of your flutter run with the -v verbose command. ld: framework not found App is an extremely generic error (it means your compiled dart framework cannot be found), and I'd like to track down why you are individually seeing it.

If you think this is related to https://flutter.dev/docs/development/ios-project-migration (did the migration not automatically happen for you?) that's helpful.

@Sauraus

This comment has been minimized.

@jmagman

This comment has been minimized.

@flutter flutter locked as resolved and limited conversation to collaborators Aug 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels.
Projects
Tools - iOS review
  
Engineer reviewed
Development

Successfully merging a pull request may close this issue.