how to solve flutter iOS framework error? - ios

when running app in flutter on iOS simulator I get this error
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/_q/npnlj1jx73dbftdw4k23clvm0000gn/T/flutter_tools.laUDdB/flutter_ios_build_temp_dirp6AQZ0/temporary_xcresult_bundle
ld: framework not found Flutter
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/_q/npnlj1jx73dbftdw4k23clvm0000gn/T/flutter_tools.laUDdB/flutter_ios_build_temp_dirp6AQZ0/temporary_xcresult_bundle
Error (Xcode): Framework not found Flutter
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.
Exited
I tried flutter clean and flutter pub get but nothing changed

Related

When I am running the demo program in flutter, it is working on Android emulator. However, it is showing error for ios emulator as below:

Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
lib/main.dart:1
Xcode build done. 10.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/7h/ndtlsfr17l5bq1b28cq8hsjc0000gn/T/flutter_tools.mraRyP/flutter_ios_build_temp_dirQqypht/temporary_xcresult_bundle
Failed to package /Users/Mattsmac/AndroidStudioProjects/Sample_1/flutter_application_1.
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/7h/ndtlsfr17l5bq1b28cq8hsjc0000gn/T/flutter_tools.mraRyP/flutter_ios_build_temp_dirQqypht/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.
Exited
What is the fix. Android simulator it works.
It looks like a dependency issue, I am not sure if it will help you, but you can try:
Delete the Pods folder and "podfile.lock"
Run "flutter pub upgrade" and "flutter pub get"
then from the ios directory run these commands
pod repo update
pod install
I hope it will resolve the issue

Flutter iOS build failed on real device with Command PhaseScriptExecution failed with a nonzero exit code

So I am trying to run my app on an iOS device, and it always failed. It runs well on iOS Simulator and android but when I tried to run on iOS device, I got this error
Xcode build done. 10.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/nw/p6_0x66x1t75x7mxp2f845_r0000gn/T/flutter_tools.scHoCB/flutter_ios_build_temp_dirncj4Fb/temporary_xcresult_bundle
Failed to package .../Testing/testing_app.
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add
output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in
target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either
add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in
target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/nw/p6_0x66x1t75x7mxp2f845_r0000gn/T/flutter_tools.scHoCB/flutter_ios_build_temp_dirncj4Fb/temporary_xcresult_bundle
Could not build the precompiled application for the device.
At first I thought that it was a problem with my flutter version, or package. But I made new app, run on device and still error. Always the Command PhaseScriptExecution failed with a nonzero exit code
I know that this one is already asked often, I opened so many threads here related to this error and tried almost everything I can find and still errors, sometimes the error details vary but all of them is phasescriptexecution.
Is there any solution to this?
Your verbose log via flutter run -v contains this important line
Target debug_unpack_ios failed: Exception: Failed to codesign
So running the app fails because codesigning was not possible. There are many proposed solutions online about this error message (1, 2). Some of them are:
Delete the build directory
Run flutter clean
and then try to run the app again

device_info_plus.framework: No such file or directory (in target 'Runner' from project 'Runner')

when I build the flutter 2.10.3 app in android studio, shows error like this:
Xcode's output:
↳
Writing result bundle at path:
/var/folders/1p/dz3r2rz55kd60_t8sgslkvvh0000gn/T/flutter_tools.EA7MO2/flutter_ios_build_temp_dir8UFRrl/temporary_xcresult_bundle
error: /Users/xiaoqiangjiang/source/reddwarf/frontend/cruise-open/build/ios/Debug-iphonesimulator/device_info_plus.framework: No such file or directory (in target 'Runner' from project 'Runner')
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/1p/dz3r2rz55kd60_t8sgslkvvh0000gn/T/flutter_tools.EA7MO2/flutter_ios_build_temp_dir8UFRrl/temporary_xcresult_bundle
I have added the device_info_plus in xcode 13.4.1, why still show this error?
I check my project and found that the device info plus was org.cocoapods.device-info-plus, version 0.0.1.

Runner.app/Runner.app/... infinite cycle Xcode build failed

When I try to build my app, I got this error in the console:
Xcode build done. 114,3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: '/Users/paul/AndroidStudioProjects/Chronopsi/build/ios/Debug-iphoneos/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app' is longer than filepath buffer size (1025). (in target 'Runner' from project 'Runner')
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
I'm on Xcode 11.3.1
I have the latest version of Flutter.
I tried to build an other old app that I already build months ago and it works fine.
EDIT:
I tried to change build to legacy but I got the same error and it's still saying "note: Using new build system" while in my log it's saying "Legacy build system detected"...
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Legacy build system detected, removing /Users/paul/AndroidStudioProjects/Chronopsi/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
Running pod install...
Running Xcode build...
Xcode build done. 57,2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: '/Users/paul/AndroidStudioProjects/Chronopsi/build/ios/Debug-iphonesimulator/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner.app/Runner' is longer than filepath buffer size (1025). (in target 'Runner' from project 'Runner')
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Check your Xcode: Targets Runner -> Build Phases -> Copy Bundle Resources.
If Runner is in the list, remove it and do flutter clean

Flutter project run on the ios13

I just update my system to the latest MacOS 10.15 , and Xcode update to 11 , my iPhone XR just update to the iOS 13.1 . I run my flutter project, then get error here
the log
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: Multiple commands produce '/Users/eriklu/development/codes/flutter/study/flutter_trip/demo/flutter_base_demo/build/ios/Debug-iphoneos/Runner.app/Frameworks/Flutter.framework':
1) Target 'Runner' has copy command from '/Users/eriklu/development/codes/flutter/study/flutter_trip/demo/flutter_base_demo/ios/Flutter/Flutter.framework' to '/Users/eriklu/development/codes/flutter/study/flutter_trip/demo/flutter_base_demo/build/ios/Debug-iphoneos/Runner.app/Frameworks/Flutter.framework'
2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
note: Using new build systemnote: Planning buildnote: Constructing build descriptionwarning: duplicate output file '/Users/eriklu/development/codes/flutter/study/flutter_trip/demo/flutter_base_demo/build/ios/Debug-iphoneos/Runner.app/Frameworks/Flutter.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/eriklu/Library/Developer/Xcode/DerivedData/Runner-cguezvpzlkcjmwafakhebgbckazf/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/Script-73506C6A4A6DF54A6CA02CB5.sh (in target 'Runner' from project 'Runner')
Could not build the precompiled application for the device.
Error launching application on 路过的程序猿.
Try opening Xcode and go to the Runner's settings and open the Build Phases tab.
Go to Embed Frameworks, you should definitely see Flutter.framework and App.Framework
Xcode screenshot
Check that actually during the update Xcode has not damaged the files in the Framework, you can usually see it by looking at the icon, but you can also use the right button and see it in the Finder.
If you should see the disabled icon or could not open it in the Finder the solution is quite simple, you just need to create a new application in Flutter and replace the Framework folders (for iOS) that are in
yourAppName / ios / Flutter /

Resources