Flutter: Could not find the built application bundle at build/ios/iphonesimulator/Runner.app - ios

I am trying to run my application in debug mode from VSCode. However, every time, regardless if I am running on a simulator or a real device, the debug console outputs
Could not find the built application bundle at build/ios/iphonesimulator/Runner.app.
or
Could not find the built application bundle at build/ios/iphoneos/Runner.app.
When I went to the specified directory, my app bundle is being built every time but instead of being named Runner.app it is named MyAppName.app. I suspect the difference in name is causing the VSCode compiler to not being able to locate Runner.app.
My question: How do I change my build settings so that the build bundle is named Runner.app again?

You might have updated the Display Name from Runner to your app name
Just open your project in Xcode and Put "Runner" back in Display Name
if you want to change the application name please go into info.plist and change bundle name from there.
Note: Changing this will not effect your app’s display name.

Did you change the "Display Name" of Runner in your Xcode project? After I tried to change the "Display Name" to a custom name I got your mentioned error. After I renamed it back to "Runner" everything works fine again.

This may be caused by the value of PRODUCT_NAME in case it has a space character.
Let remove all space characters in your PRODUCT_NAME value.
Add CFBundleDisplayName key to the Info.plist if you want to config the app name (bellow the app icon).
eg.
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleDisplayName</key>
<string>$(APP_DISPLAY_NAME)</string>
// xcconfig file
PRODUCT_NAME = Flutter_App
APP_DISPLAY_NAME = Flutter Dev

Maybe you changed name of the application via xcode? Then in
ios/Runner.xcodeproj/project.pbxproj and find
PRODUCT_NAME
Then set
PRODUCT_NAME = Runner
Before Run use flutter clean && flutter run

Change App name to Runner. If this doesn't work then Select Runner->Runner(Target)->Build Settings->Packaging-> "Product Name" change it to Runner.
That will definitely work.

This happened to me when I created PUSH certificates for my app and also updated Flutter SDK.
Not sure what caused this but below solution worked for me.
To resolve this, try below measures, preferably sequentially in terminal:
cd "$(xcrun --sdk iphoneos -- show-sdk-platform-path)/DeviceSupport"
sudo ln -s 10.3.1\ \(14E8301\) 10.3
After running these commands, it should work fine, and if not, try run this command below in terminal:
flutter clean
More details :
https://xinyustudio.wordpress.com/2019/02/12/flutter-could-not-install-build-ios-iphoneos-runner-app/
https://medium.com/#xinyustudio/flutter-could-not-install-build-ios-iphoneos-runner-app-1f355f18c9d9

Related

xcode 13 executable file not found

I've an error with xcode 13. When i try to run my app on a real device (arm64 architecture) i got the following error:
Executable Not Found
Domain: DVTMachOErrorDomain
Code: 5
Recovery Suggestion: /path/to/file/MyApp.app is not a valid path to an executable file. Please rebuild the project to ensure that all required executables are created. Check your project setting to ensure that a valida executable will be built.
has anyone ever had this problem? The build process finish without errors. Right now i've excluded x86_64 architecture from "Excluded Architectures" option and set the parameter "Architectures" to "Standard Architectures (arm64, armv7)".
TARGET -> Build Settings, search 'VALID'.
Set VALID_ARCHS, add if run with a simulator, else set arm64.
I faced the same problem and resolved it by deleting files and folders below,
Pods ,
Podfile.lock and
mme.xcworkspace
And running pod install
This Error occur because there was a missing file.
Click on the Error icon on the top header and you redirect to errors there you notice there are some files that are not there or missing.
Added the file and run your project again working correctly.
I got the same error and it was just because I didn't change the build settings correctly after I renamed the folder where Info.plist belongs to.
So I needed to change this setting so that it was the same with the actual path of Info.plist:
Did you make sure that the executable file MyApp located in your folder /path/to/file/MyApp.app/ matches the value of the Executable file attribute in your Info project file?
On my machine, the executable path is : /Users/.../DerivedData/Debug-iphonesimulator/Runner.app/Runner. I noticed that the executable name (Runner in my case) was wrong in the Info file. Correcting it fixed the issue for me.
See the the screenshot below :
Check if there are any deleted files(which happens when you pull the code from Git) and add those files back, Close Xcode, Restart the system, Clean the Project and Run the Project this Worked for me.
I had this error as well.
This is not a blanked solution fix.
For me Xcode had some broken references to files, so I had to connect them and set the file location to be "relative to group" vs "relative to project"
The error was being incorrectly reported as "Executable not found" when building the error was more clear.
Build input file cannot be found: '/Users/MY_USER_NAME/Programs/ios/PROJECT_DIR/SRC/file.xib' is not found.
Some file is missing, you just have to add from project folder. Just restart your Mac and open XCode with your project, you will see the missing file.
I have previously tried every possible solution like cleaning derived data, running pod install but nothing worked. Try above solution
Perhaps the executable file entry is wrong in your Info.plist?
The entry Executable file should be set to $(EXECUTABLE_NAME).
Targets -> Build Settings, search plist
Set Generate Info.plist File to No, set Info.plist File with your info.plist file path.
That's works for me.
I encountered this issue just now after setting up a new prefix header to my product target with a wrong file path:
$(SRCROOT)/$(PROJECT_NAME)/PrefixHeader.h
Correct it to
$(SRCROOT)/$(PROJECT_NAME)/PrefixHeader.pch
resolved my issue. What a stupid Xcode!
pod install or pod install --repo-update should work !
For me, I removed the files in Recovered Reference folder. Then this error gone.
Fast forward to 2022, I got this error after having installed a TestFlight version and was trying to run from Xcode. I deleted the app off my phone, ran again, and was able to install successfully. I hope this helps someone!

Ensure that the application's Info.plist contains a value for CFBundleIdentifier. Print: Entry, ":CFBundleIdentifier", Does Not Exist

I am attempting to build my first iOS app using this repo:
https://github.com/pmusaraj/discourse-mobile-single-site-app
When building, I receive an error and cannot move forward. I am an absolute noob who will spend long hours on this, but have no idea if I’ve reached a point of failure in the code that I can move beyond with some simple tweaking, or if I must wait for my Issue (opened on the repo) to be resolved by the dev. I assume the dev is busy with other projects and may not have time to help.
Perhaps my software is too new for this? Should I try versioning back react-native and XCode? I could downgrade to XCode 9.2 (Dec 2017 to March 2018 version) and react-native to 0.53.0 (January 2018 version).
My machine:
Mac OSX: 10.14.6
react-native-cli: 2.0.1
react-native: 0.58.6
XCode: 10.3 (build 10G8)
Issue: The info.plist file is not playing nicely with the builder. Inside /ios/DiscoSingle/Info.plist, I see CFBundleIdentifier properly defined as:
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
This looks correct to me.
Here’s the error when running react-native ios-build:
The following build commands failed:
Ld /Users/user919021/Desktop/discourse/ios/build/Build/Products/Debug-iphonesimulator/DiscoSingle.app/DiscoSingle normal x86_64
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/DiscoSingle.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DiscoSingle.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DiscoSingle.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:629:11)
at Object.execFileSync (child_process.js:647:13)
at Promise.then (/Users/user919021/Desktop/discourse/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
at process._tickCallback (internal/process/next_tick.js:68:7)
From my experience, the Bundle Identifier name in your git, was forgot to fill. so, you must add that bundle identifier name in info plist> Signing & capabilities. You can add something like: com.habiesmart.myapps, etc.
Just like that, and eureka! you can run that project!
Best, Habie.
Error cause: In my case, I moved the info.plist which broke the build. The error continued to occur after moving the info.plist back.
Solution: Everything regarding bundle appeared to be correct. The fix was to change an unrelated entry in the info.plist and run the build. This caused the process to correct itself. Then I set the changed info.plist entry back to its original setting and again, the build ran successfully.
(FWIW, I picked "Application supports indirect input..." to change)
In my case everything was correct in Info.plist file. Bundle identifier were also there for respective environments. Issue was with GoogleService-Info.plist file. It was missing at given path.
For those still having the same issues you probably moved your info.plist file you need to tell Xcode where to find it go to build settings and ensure the correct path for the info.plist file is stated there. Here is an image:
In my case, it was something with my main storyboard or launch screen. I think I deleted them on the file system and then tried to build a project but got the error at the end. After I deleted those files in the Xcode project and added them back it started to run on a simulator.
It could be multiple reason
For below is worked
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
Added bundle identifier in Info.plist & error gone.
Project->Info.plist->Open as source code
<key>CFBundleIdentifier</key>
<string>com.CompanyName.movies</string>
Sometime it's a little bit strange, in my case I suggest we check our project directory in finder because sometime our plist file doesn't stay inside the right directory as we set inside our Project Build Setting so Xcode doesn't be able to locate that plist file, and because of that compiler will show this error.
This was my problem I try to figure this out for almost 30 min, then I decide to open my project directory, and I see that the plist file didn't stay inside the right directory as I set inside Project Build Setting.
This happen because I tried to separate Project Target Schema.
Hope this help someone who face this problem and can't figure it out like me too.
I found that while there was an Info.plist file in the directory with the App declaration I mustn't be adding properties there but rather need to click the project title on the left pane to access the project navigator, then, select my target, then, select "build settings" and scroll down to Info.plist values.

Could not get GOOGLE_APP_ID in Google Services file from build environment

For setting up firebase i am using two config 1.GoogleService-Info-test.plist, 2.GoogleService-Info-prdn.plist for UAT and Production. For installing crashlytics using firebase i have followed firebase documentation https://firebase.google.com/docs/crashlytics/get-started?authuser=1#ios. But when i try to run, it throws error in build phase while running script.
I tried without changing config file name and it worked.
Error msg at build phase while running fabric run script "Could not get GOOGLE_APP_ID in Google Services file from build environment".
Can anyone suggest better solution to achieve my requirement.
This is one way you can do it, by having your projects environments separated by targets, by doing so you can then add your different plist files and just check the target that they belong to, that way when you compile the target it will take it's corresponding plist file
Another way to do it, or to look up how to do it, it's called multiple environments with firebase, here are some helpful links
Use different GoogleService-Info.plist for different build schemes
https://medium.com/rocket-fuel/using-multiple-firebase-environments-in-ios-12b204cfa6c0
This worked for me:
When install Crashlytic with Firebase, for multiple scheme, you can have error Could not get GOOGLE_APP_ID in Google Services file from build environment. You can fix it by:
In Build Settings, add a user define for file name in User Defined:
In Build Phases, tap plus button, New Run Script Phase above your Crashlytic build phase, and type this code to the text field. Remember to rename %YOUR_CUSTOM_PATH_TO_FOLDER% to your path to Plist files:
GOOGLE_SERVICE_INFO_PLIST_FROM="${PROJECT_DIR}/%YOUR_CUSTOM_PATH_TO_FOLDER%/${FIREBASE_CONFIG_FILE}.plist"
BUILD_APP_DIR="${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}"
GOOGLE_SERVICE_INFO_PLIST_TO="${BUILD_APP_DIR}/GoogleService-Info.plist"
cp "${GOOGLE_SERVICE_INFO_PLIST_FROM}" "${GOOGLE_SERVICE_INFO_PLIST_TO}"
This worked for me:
Make sure you add the Xcode Crashlytics build phase after Copy Bundle Resources.
I had this in my "Build Phases" and it's works
"${PODS_ROOT}/FirebaseCrashlytics/run"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/MyApp/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
Our project only one target, but we need to use two Firebase config files GoogleService-Info-Prod.plist and GoogleService-Info-Dev.plist.
I had this in my "Build Phases" and it works.
if [ "${CONFIGURATION}" = "Release" ]; then
${PODS_ROOT}/FirebaseCrashlytics/run -gsp ${PROJECT_DIR}/RushCard/FirebaseConfig/GoogleService-Info-Prod.plist
else
${PODS_ROOT}/FirebaseCrashlytics/run -gsp ${PROJECT_DIR}/RushCard/FirebaseConfig/GoogleService-Info-Dev.plist
fi
In my case I created New Run Script Phrase above Compile Sources, that's why I always see
Could not get GOOGLE_APP_ID in Google Services file from build environment
When I moved Crashlytic's run script at the end of list bug was disappear. Please look the following screen shot:
And article about it is here
I use multiple configurations for several white-labelled apps. I added a User-Defined variable FIREBASE_SUFFIX and changed my script to the following:
${PODS_ROOT}/FirebaseCrashlytics/run -gsp ${PROJECT_DIR}/Firebase/GoogleService-Info-${FIREBASE_SUFFIX}.plist
NOTE: I use Carthage for firebase here: https://github.com/firebase/firebase-ios-sdk/blob/master/Carthage.md. If you're this same setup, you should use something like this instead (replace the path to where you put your script files):
${PROJECT_DIR}/scripts/run -gsp ${PROJECT_DIR}/Firebase/GoogleService-Info-${FIREBASE_SUFFIX}.plist
Another way is to make sure one plist keeps the original name GoogleService-Info.plist
Different targets meant more work to update CI for me.
This is valid for Xcode 11 at least, not tested on any other versions
I was using new Firebase/Crashlytics which beta and getting error "No Google App ID or Google Services file provided" when I try to upload manually dSYMS
Here is command:
/path/to/pods/directory/FirebaseCrashlytics/upload-symbols
-gsp/path/to/GoogleService-Info.plist -p ios /path/to/dSYMs
Then I reliaze there should be space between "-gsp" and path to Google.plist after that It worked.
The solution for me was removing the call to upload-symbols script.
One of the Crashlytics guides mentions you should add this:
${PODS_ROOT}/FirebaseCrashlytics/run
/path/to/pods/directory/FirebaseCrashlytics/upload-symbols <- Not needed
I misinterpreted this... the run script already calls upload-symbols so there's no need to add a second call.
Make sure in Xcode file explorer (i.e on the left side) "GoogleService-Info.plist" is showing. If not you have to drag and drop "GoogleService-Info.plist" in the Xcode panel.
In my case problem is I copy-pasted the file in the project location, due to this file reference is missing in the Project info.
Well all above answers purpose a possible solution for this issue, in my case GoogleService.plist file was missing from 'Copy Bundle Resources' by adding into it worked in my case..
To check the file goto
Project Directory >> Build Phases >> Copy Bundle Resources
add it add here if you find missing.
If these solutions provided above do not work, I solved mine by going to Build phases as shown on this image. Click on plus and add Google plist
I was able to fix this by locate where is my GoogleService-Info.plist, copy it to ios folder in Flutter and run with this script
"$PODS_ROOT/FirebaseCrashlytics/upload-symbols" --flutter-project "$PROJECT_DIR/firebase_app_id_file.json" -gsp "$PROJECT_DIR/GoogleService-Info.plist" -p ios "$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME"
Update:
I found a better solution:
Just upgrade all firebase package to lastest version
Remove Crashlytics build script
Run flutter clean, flutter pub get
pod install (in ios folder)
I had this issue because I didn't download GoogleService-Info.plist file from Firebase console.
If you have your project on Firebase but missing this file in Xcode, don't worry, you don't need to do the setup again from the beginning. Just go to:
Project Settings > General > Scroll down and in the "Your Apps" panel you will see the file and you can download it and import it in the Xcode project.
I had the same error, also due to the fact that I have multiple bundle identifier and therefore I have a build phase script called Firebase Script (that pinpoints to the correct GoogleService-Info.plist ) that was running after the Crashlytics script.
The solution is to run Firebase Script before the Crashlytics script.
In my case I had a different name in my file, his name was GoogleService-Enterprise-Info.plis when I change it to the normal name GoogleService-Info.plist, IT WORK FINE !!
I faced the same issue for #react-native-firebase/crashlytics
In case you are facing this issue, you probably have missed the 'ios setup' instruction mentioned in below link. Please follow the instruction to fix the issue.
https://rnfirebase.io/#generating-ios-credentials
Just download from Settings of your projects and place for your correct target which you are running.
This error would be shown if there is a space in your project name or in the path of your project.
Read more in this GitHub Issue
Additionally to other answers..
I faced that problem with exact same error message and in my case everything was ok with file GoogleService-Info.plist except that it was genereated with wrong Bundle ID for application (it was changed in XCode much later than initial Firebase setup happened), so I had to create new app in Firebase Console with correct Bundle ID (it's not able to edit) and download new GoogleService-Info.plist
If you are using one of the popular build scripts going around for handling multiple different environments, it is probably useful to know that you should use a different GoogleService-Info.plist destination based on the target platform:
// iOS
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
// watchOS
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.appex
// macOS
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Resources
Ultimate guide:
Assure that in Runner folder you have file GoogleService-Info.plist and it is attached in your project
If you don't have this file go to Firebase Console, add you IOS app and download the GoogleService-Info.plist file, then add it to you project's Runner folder by XCode.
If there is no such file in XCode but it exists physically in the folder then right click on Runner folder (in Runner project) -> Add files to Runner -> Select that file
If you want to use multiple flavors add ENV_SUFFIX in Runner (target) -> Build Settings -> User-Defined (on the bottom)
Still in the target's Runner change tab to Build Phases -> Press Plus button -> New Run Script Phase -> Name it as Copy GoogleService-Info.plist and add this line
cp Runner/GoogleService-Info_${ENV_SUFFIX}.plist Runner/GoogleService-Info.plist
IMPORTANT! This script has to be before Initialize Crashlytics step or any other Firebase related script (you can drag it to the top)
Add other GoogleService-Info.plist files with suffix for the env. In my case those would be the _dev _prod and _tst files from the first screen shot
Enjoy multiflavor app
Try downgrading, it worked for me!
I used:
'Fabric', '1.9.0'
'Crashlytics', '3.12.0'

Add value to Info.plist array after building (but before installing)

I have an Xcode project that builds into a few different apps (whitelabels) using different configurations.
For a new payment method I need each app to have a unique CFBundleURLScheme.
I wrote the following "Run Script" that is before Compile Sources in "Build Phases".
INFO_PLIST="${PROJECT_DIR}/${INFOPLIST_FILE}"
plutil -insert CFBundleURLTypes.0.CFBundleURLSchemes.0 -string "swish${PRODUCT_BUNDLE_IDENTIFIER//.}" $INFO_PLIST
This adds the value swishourbundleidentifier. (So, swish + our.bundle.identifier, but without the dots)
This currently changes the actual Info.plist. What I want is that it changes the Info.plist that's in the folder where the app is built to, so that it is overridden each time (so there are no double values) and that the added value doesn't show up in git.
How would I go about that? I guess it's simply changing "${PROJECT_DIR}/${INFOPLIST_FILE}", but to what?
If any more information is needed, please let me know.
EDIT: Actually, if it is possible, a better solution would be to add something like swish${PRODUCT_BUNDLE_IDENTIFIER//.} in the Info.plist's URL Schemes. So that it's compiled to that on build time, but no double values. I tried this but it doesn't seem to work like that unfortunately.
You could access to build directory with
$CONFIGURATION_BUILD_DIR/$CONTENTS_FOLDER_PATH
Reference: https://help.apple.com/xcode/mac/10.2/#/itcaec37c2a6
(Xcode 11.2)
It is possible to do what you're asking:
You can get the path of the app bundle's Info.plist at ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}.
BUT: In the New Build System, any custom build steps will run before the New Build System's Process .../Info.plist step, so you cannot edit the app bundle's plist via a Run Script step to Build Phases, because your changes will just be overwritten:
To run a shell script after Xcode finishes building, you can add it to your scheme(s) as a build post-action:
Product > Scheme > Edit Scheme... > Build > Post-actions
If you're going to reference any build system environment variables (e.g. BUILT_PRODUCTS_DIR or INFOPLIST_PATH), make sure you select your app target in Provide build settings from.
Add your shell script, but remember that if you edit any file in the app bundle (i.e. Info.plist), you'll need to re-sign the app. Add this to your script:
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
/usr/bin/codesign --force --sign - --entitlements "${TARGET_TEMP_DIR}/${FULL_PRODUCT_NAME}.xcent" --timestamp=none "${CODESIGNING_FOLDER_PATH}"
App bundle is read-only. Info.plist is in app bundle

React Native running app on device without server

Its unbelievable how bad the documentation is for React Native, they just put as little as possible for everything. I've already managed to run my app using option 1 but option 2 is even more unclear: https://facebook.github.io/react-native/docs/running-on-device-ios.html
I don't know there's no example of the terminal command react-native bundle in full so I know what is actually required there. For example --entry-file <path> what path? The whole path from my hard drive root to this folder, or just the file itself? --bundle-output....? What the hell do I need to put for that? I don't know why they need to make it so damn unclear.
I'm surprised there's no other resources online that give the instructions more clearly. I guess that's why there aren't so many React Native apps on the app store.
I hope you also find that this is a much easier approach. In the example below, my app was named BleMobileApp. Feel free to change it to your app's name.
RUN APP ON DEVICE WITHOUT DEBUG SERVER
Duplicate the main deployment target and name it BleMobileApp-Deploy.
Make sure to REMOVE the DEBUG=1 flag in BleMobileApp-Deply's Build settings (Do not touch the original target BleMobileApp!)
Add a New Run Script Phase to BleMobileApp-Deploy's Build phases and paste following command:
yes | cp -rf ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/main.jsbundle $SRCROOT/main.jsbundle
That's it!
(OPTIONAL) In case you would like to MINIFY the JS Bundle!
Edit file ./node_modules/react-native/scripts/react-native-xcode.sh like below (Line 43~47)
2. Change the default run script like below (For BleMobileApp-Deploy target):
export NODE_BINARY=node
FORCE_MINIFYING=true ../node_modules/react-native/scripts/react-native-xcode.sh
This should do the trick for you.
Happy coding!
From React Native Docs:
Configure release scheme Building an app for distribution in the App Store requires using the Release scheme in Xcode. Apps built for Release will automatically disable the in-app Developer menu, which will prevent your users from inadvertently accessing the menu in production. It will also bundle the JavaScript locally, so you can put the app on a device and test whilst not connected to the computer.
To configure your app to be built using the Release scheme, go to Product → Scheme → Edit Scheme. Select the Run tab in the sidebar, then set the Build Configuration dropdown to Release.
This can be done from the terminal:
react-native run-ios --device "My iPhone" --configuration Release
the best way i could find,
just follow the step bellow
Product → Scheme → Edit Scheme
Select the Run tab in the sidebar
Build Configuration dropdown to Release
sometimes metro bundle starts, may be its bug in IOS but you can close it
Please see the attached screenshot

Resources