Android Studio KMM Application project - Build for ios platform failing - ios

I am a first timer on KMM and have just created a new KMM application project on Macbook M1 Pro. No code changes, this is just the hello world app that I am using. I have been able to successfully build the project for android platform, and it runs fine on the android emulator. However, when I try to build it for the ios platform, it is failing with the below error message:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':shared'.
> The project must have a target for at least one of the following platforms: ios_simulator_arm64.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 553ms
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Build\ shared /Users/manajit/Projects/Learning/App/KMMExperiment/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-4552119A071AC6BAB7327E6434237EC3.sh (in target 'shared' from project 'Pods')
(1 failure)
Command PhaseScriptExecution failed with a nonzero exit code.

Currently, the base application created by the KMM plugin has commented out support for the ARM simulator because there are some libraries that do not yet support it. This is most likely due to Ktor, which only recently added its support.
Go to shared/build.gradle.kts and uncomment all lines containing iosSimulatorArm64.

Related

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

PhaseScriptExecution when trying to execute ionic cordova run ios

When I tried to build my application on IOS emulator, it shows the following error, I search online and I found it has something to do with Pod, but I didn't get any useful solutions for this.
The following build commands failed:
PhaseScriptExecution Copy\ www\ directory /Users/kai/Library/Developer/Xcode/DerivedData/RADAR_Questionnaire-ewiaqvtxwvvffzdyqzeazoxksrcm/Build/Intermediates.noindex/RADAR\ Questionnaire.build/Debug-iphonesimulator/RADAR\ Questionnaire.build/Script-304B58A110DAC018002A0835.sh (in target 'RADAR Questionnaire' from project 'RADAR Questionnaire')
(1 failure)
xcodebuild: Command failed with exit code 65
By the way, the app can build fine until I upgrade my mac from 11 (Big surf) -> 12 (Monetary ), I am not sure does it have something to do with the upgrade.

Problems starting ios simulator with flutter

Hi I have the following error trying to debug an ios simulator with flutter. I used the flutter doctor command and also flutter doctor -v but it tells me there is no error. I also tried doing a flutter clean and then flutter run but the error persists. Has someone else happened to? Beforehand thank you very much!
lib/main.dart:1
Xcode build done. 36,1s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Failed to package /Users/pedrocarrasco/Desktop/nuevo.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12.
Exited (sigterm)

Could not find an option named "DartDefines"

When I open up an IOS simulator to launch my flutter apps, it fails. Before it used to work fine. I get the following error:
Xcode build done. 122.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Could not find an option named "DartDefines".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11.
Exited (sigterm)
I tried the following
Getting error when launching flutter apps in simulators.
I have the same issue, and I've fixed it by running two command.
Please try, hope it help.
flutter channel dev
flutter upgrade
Good luck!

running command "xcodebuild" exited with error code 65

I have written a project with react-native and it works on Android. Now I want to run it on ios. When I build my project in Xcode it is okay and I have the "Build succeed" message. But when I run the project in my IDE I have the following Error:
error Failed to build ios project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening MyProjectName.xcodeproj
** BUILD FAILED **
The following build commands failed:
myProjectDirectory/ios/build/MyProjectName/Build/Products/Debug-iphonesimulator/ReactNativeNavigationTests.xctest/ReactNativeNavigationTests normal x86_64
(1 failure)
....
I have tried bellow solutions, but none of them worked for me:
1- I removed the build folder from ios and rebuild the project again.
2- I ran "npm dedupe"
3- I built a simple new project and I could see "Welcome to React Native..." page on iphone.Then I installed wix v2 library in this project and I could see the page again. It means my problem is not about xcode version or wix installation steps.
4- I have clean and rebuild my project in xcode.
I searched a lot on the internet. But I couldn't find any helpful solution.
Any suggestion will be helpful.
It seems your tests are failing.
Try to run tests from Xcode and see if they are ok because my bet is they will fail.

Resources