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

[App.framework] Linked and embedded framework 'App.framework' was built for iOS/iOS Simulator #50568

Closed
JagandeepBrar opened this issue Feb 11, 2020 · 45 comments · Fixed by #51453
Assignees
Labels
c: regression It was better in the past than it is now t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@JagandeepBrar
Copy link

JagandeepBrar commented Feb 11, 2020

SOLUTION

@jmagman has written an article on how to solve this problem for your project: https://flutter.dev/docs/development/ios-project-migration

Steps to Reproduce

  1. Prepare application for running
  2. Run flutter run or flutter run --debug
  3. Build fails

Logs

Terminal Output

Screen Shot 2020-02-11 at 9 28 03 AM

flutter doctor -v

➜ flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.4 19E224g, locale en-CA)
    • Flutter version 1.12.13+hotfix.7 at /Users/jagandeepbrar/Development/flutter
    • Framework revision 9f5ff2306b (2 weeks ago), 2020-01-26 22:38:26 -0800
    • Engine revision a67792536c
    • Dart version 2.7.0

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

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

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 40.0.2
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

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

[✓] Connected device (1 available)
    • iPhone 8 Plus • 934E82BE-9245-43CC-8A33-9E17C8806E78 • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

• No issues found!

Notes

This appears to have started since upgrading to Catalina 10.15.4 beta with Xcode 13.4 beta, which also updated Simulator to 13.4 (921.4).

The application compiles and runs correctly on a physically attached device, but no simulators of any devices can pass this stage.

EDIT: Just attempted both Flutter beta and dev channels, and the same error occurs after rebuilding the tools and running flutter clean in the project root.

@JagandeepBrar
Copy link
Author

As an update, just finished reinstalling the stable release of Xcode and using xcode-select to set it back to 11.3.1, and it works as expected. Launches in all emulators.

Something must have broken in 11.4 beta.

@jmagman
Copy link
Member

jmagman commented Feb 12, 2020

I'm also on Xcode 11.4 beta and I just created a new app and was able to flutter run -d <simulator> without build errors on Flutter 1.12.13+hotfix.7.

  1. Did you run sudo xcodebuild -runFirstLaunch after you xcode-select to Xcode 11.4?
  2. Are you able to run on that simulator from ios/Runner.xcworkspace in Xcode?

@jmagman jmagman added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 12, 2020
@JagandeepBrar
Copy link
Author

Hi @jmagman, thanks for responding. Yes, I did do the first run and I have tried running through Xcode as well and it is throwing me the same error.

Screen Shot 2020-02-11 at 8 40 19 PM

Let it be noted that it can build for generic iOS devices, and can run on physical devices, but is only showing this error on simulators.

With both Xcode's installed together, I can use the beta (11.4) simulator with stable Xcode (11.3.1) and it works correctly. So it must be something in Xcode 11.4 that is causing the issue.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 12, 2020
@jmagman
Copy link
Member

jmagman commented Feb 12, 2020

I briefly saw this error, and I'm not sure how to I got into or out of that state.

It's failing to even start the build to get to the script that would assemble the right variant. We could swap App.framework to App.xcframework but that would be a nightmare of a project file migration...

@jmagman jmagman added t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels. labels Feb 12, 2020
@jmagman jmagman added this to Awaiting triage in Tools - Xcode review via automation Feb 12, 2020
@jmagman jmagman moved this from Awaiting triage to Engineer reviewed in Tools - Xcode review Feb 12, 2020
@jmagman
Copy link
Member

jmagman commented Feb 12, 2020

Does rm -rf ios/Flutter/App.framework get you unstuck?

@JagandeepBrar
Copy link
Author

I reset my ios folder, which effectively deleted App.framework since it's in the .gitignore, and it seems to be working now! Works from both Xcode 11.4 and flutter run -d <id>.

@jmagman
Copy link
Member

jmagman commented Feb 12, 2020

Glad you have a workaround, but this is concerning so I'm going to reopen until we understand how often this is happening.

Can you let us know if you see it again, and how you got in that state?

@jmagman jmagman reopened this Feb 12, 2020
Tools - Xcode review automation moved this from Engineer reviewed to Awaiting triage Feb 12, 2020
@jmagman jmagman moved this from Awaiting triage to Engineer reviewed in Tools - Xcode review Feb 12, 2020
@JagandeepBrar
Copy link
Author

I had another machine that had a copy of the project on it. Using the App.framework from that project causes the issue to reappear. I have attached an archive that contains both a working and non-working copy of App.framework. I hope that can help you with the debugging!

If there are any other files you may want please let me know!

Issue 50568.zip

@JagandeepBrar
Copy link
Author

JagandeepBrar commented Feb 12, 2020

With the rebuilt App.framework I am not longer able to launch on my physical device. I now get this:

Screen Shot 2020-02-11 at 10 11 07 PM

It appears that the first build of App.framework causes it to only be compatible with the device type (simulator or physical) that is being used for that run.

Deleting App.framework will cause it to be rebuilt on the next run and it will work correctly until you switch device types again. Running just flutter clean isn't enough, but you'll have to run it when you delete App.framework otherwise it will try to install the cached build.

Again this only occurs with Xcode 11.4/Simulator 11.4. I did a build for physical devices which created an App.framework. Attempted to launch with Simulator 11.4 running an iOS 13.4 image and it failed to launch. I switched the command line tools back to Xcode 11.3/Simulator 11.3, and without changing App.framework it still works.

@genert
Copy link

genert commented Feb 17, 2020

Can confirm, you have to remove App.framework when switching device from simulator to physical device and vice versa on XCode 11.4 at least.

I propose that when running flutter clean, it must check system installed XCode version and if it matches the criteria then it must remove App.framework in ios/Flutter folder but let's wait what Apple says on this first.

Wrote to Apple's support to enquiry information about this change as this information cannot be found in their change logs (at least not in XCode 11.4 one) -https://developer.apple.com/documentation/xcode_release_notes/xcode_11_4_beta_release_notes

They did change how test frameworks are built, perhaps this "feature" is undocumented side effect of that.

@jmagman
Copy link
Member

jmagman commented Feb 25, 2020

Xcode 11.4 seems very un-amenable to a thinned App.framework...
\cc @jonahwilliams

@jonahwilliams
Copy link
Member

I don't think there is a technical limitation to building all of the simulator and device arches and lipoing them together ... provided that works, right?

@jmagman
Copy link
Member

jmagman commented Feb 25, 2020

I don't think there is a technical limitation to building all of the simulator and device arches and lipoing them together ... provided that works, right?

I think that's probably the best path forward.
Ideally we could create an App.xcframework, particularly since Xcode 11 is the new minimum version required. However I don't know how to migrate existing Xcode projects to point update "App.framework" to "App.xcframework".

@JagandeepBrar JagandeepBrar changed the title [iOS Simulator] Building for iOS Simulator, but the linked and embedded framework 'App.framework' was built for iOS. [App.framework] Linked and embedded framework 'App.framework' was built for iOS Feb 25, 2020
@JagandeepBrar JagandeepBrar changed the title [App.framework] Linked and embedded framework 'App.framework' was built for iOS [App.framework] Linked and embedded framework 'App.framework' was built for iOS/iOS Simulator Feb 25, 2020
@zanderso zanderso added the c: regression It was better in the past than it is now label Feb 25, 2020
@jmagman
Copy link
Member

jmagman commented Feb 25, 2020

flutter clean to remove ios/Flutter/App.framework is in #12631

@jmagman
Copy link
Member

jmagman commented Feb 26, 2020

There's actually no reason to link on App.framework, it just needs to be embedded.

@jmagman
Copy link
Member

jmagman commented Feb 26, 2020

But if you remove the link, the next error is:

 Building for iOS Simulator, but the embedded framework 'App.framework' was built for iOS.

@genert
Copy link

genert commented Mar 5, 2020

Confirming here as well that it works. Nice job @jmagman !

@Moosphan
Copy link

Moosphan commented Mar 6, 2020

YEAH, in latest version, it has been solved.

@bingxio
Copy link

bingxio commented Mar 15, 2020

It's a terrible problem. I ran successfully on the simulator, but I failed again on the real machine.
error: Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator. (in target 'Runner' from project 'Runner')

@jmagman
Copy link
Member

jmagman commented Mar 16, 2020

@Turaiiao

If anyone is hitting this issue and the tool isn't automatically migrating you, please see manual migration instructions at https://flutter.dev/docs/development/ios-project-migration.

Nothing should be linking on App.framework after following those instructions. You're still seeing the error?

@bingxio

This comment has been minimized.

@Bathant

This comment has been minimized.

@jmagman
Copy link
Member

jmagman commented Mar 17, 2020

#51453 is in v1.15.4 and will be in the beta channel any second. If you switch from beta, dev, or master back to stable, you may hit this issue. Please try the migration steps at https://flutter.dev/docs/development/ios-project-migration.

@Bathant @Turaiiao the instructions don't say to delete the App.framework (your compiled dart code) from your machine, it says to remove the reference from Xcode. Please follow those instructions, or stick to a Flutter version v1.15.4 or higher.

@blueberryparm

This comment has been minimized.

@JagandeepBrar

This comment has been minimized.

@blueberryparm

This comment has been minimized.

@ArthurKnight
Copy link

DO this and can't install app . No code signature found

@jmagman
Copy link
Member

jmagman commented Mar 27, 2020

@ArthurKnight Did you follow the instructions in https://flutter.dev/docs/development/ios-project-migration?

Particularly the build phase:

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

@eospi

This comment has been minimized.

@jmagman

This comment has been minimized.

@leecommamichael

This comment has been minimized.

@jmagman

This comment has been minimized.

@i-asimkhan
Copy link

@jmagman Thanks for this.

@coduy96

This comment has been minimized.

@Abhishek0116
Copy link

Does rm -rf ios/Flutter/App.framework get you unstuck?

This is working perfectly.

@wangfeng211

This comment has been minimized.

@jmagman

This comment has been minimized.

@mbaleczny

This comment has been minimized.

@jmagman

This comment has been minimized.

@flutter flutter locked as resolved and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.
Projects
Tools - Xcode review
  
Engineer reviewed
Development

Successfully merging a pull request may close this issue.