I have bought a new MacBook Air with M1 chip a few days ago and am just trying to set up my react native and Xcode etc. running for writing iOS app.
I have had some issues with "npx react-native init AwesomeProject" previously but hopefully it has been solved. React-Native Error + Bug in Ruby Interpreter: Failed to install CocoaPods dependencies for iOS project, which is required by this template
I assume the init was successful because I got the following run instructions in color:
Run instructions for Android:
• Have an Android emulator running (quickest way to get started), or a device connected.
• cd "/Users/boscotsin/Documents/react/test4" && npx react-native run-android
Run instructions for iOS:
• cd "/Users/boscotsin/Documents/react/test4" && npx react-native run-ios
- or -
• Open test4/ios/test4.xcworkspace in Xcode or run "xed -b ios"
• Hit the Run button
Run instructions for macOS:
• See https://aka.ms/ReactNativeGuideMacOS for the latest up-to-date instructions.
I then proceed to the second step according to React Native document which is to cd into the directory and then run "npx react-native start" but then it won't work. I am given two options:
To reload the app press "r"
To open developer menu press "d"
And whichever option I choose it will say no apps connected and I will be greeted with either of these:
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
info Reloading app...
warn No apps connected. Sending "devMenu" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
info Opening developer menu...
I also try to run "npx react-native run-ios" directly and it will also say the build is unsuccessful...
May I know what is wrong here?
Or should I just reinstall Xcode or some other things once and for all???
Related
I'm trying to run my React Native project on XCode so that I can get it to run on my iOS device, everything works perfectly fine in VS Code and the Simulator software, but XCode simply refuses to build the project, throwing the error:
error build: Command PhaseScriptExecution failed with a nonzero exit code
This error occurs even when I try running an untouched new project (the example init project from react-native).
I tried these solutions:
deintegrating and reinstalling pods
running this command: npx react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/main.jsbundle
Locking and unlocking the "login" keychain, I wasn't able to lock the keychain in the first place, the option is greyed out. What could cause that?
run pod install in the ios directory
I use:
XCode 14.0.1
M1 Macbook Air
MacOS Big Sur 12.6
React Native 9.1.3 (at least that's what npx react-native -v says, but node modules -> react-native -> package.json in my project says it's 0.70.1)
If there are any more details you need please let me know, thanks.
EDIT: Here's a screenshot of the build's report in the report navigator
screenshot
I'm trying to run iOS simulator for my react native app react-native run-ios. it builds and metro bundler CLI runs, the device simulator is running, but the app does not connect with the metro bundler.
im running "react-native": "0.66.0"
xcode 13.0
I kill all simulators 1st. then run the cmd react-native run-ios
1st window builds the app and launches window 2
$ react-native run-ios
info Found Xcode workspace "app.xcworkspace"
info Launching iPhone 13 Pro Max (iOS 15.0)
info Building (using "xcodebuild -workspace app.xcworkspace -configuration Debug -scheme app-local -destination id=28EE92ED-7ADA-4A93-998F-1DB295E06A73")
success Successfully built the app
info Installing "/Users/me/Library/Developer/Xcode/DerivedData/app-clbjkkdzbwdgfsfruhrufuliemky/Build/Products/Debug-iphonesimulator/app-dev.app"
info Launching "com.myapp.app.dev"
success Successfully launched the app on the simulator
✨ Done in 168.65s.
%
window2 the metro bundler, cant find the simulator.
[metro welcome ascii art]
To reload the app press "r"
To open developer menu press "d"
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
info Reloading app...
window3, the ios simulator
iphone 13 pro max is open and running. but my app is not running
I see my app icon. and i try to run it, but its auto closes, with window 2 message showing "warn No apps connected..." message.
What I tried and doesnt do anything
removed node_modules and ran yarn install
removed podfile.lock and pod folder. ran pod install
made sure xcode > product > scheme > build config > debug. not release.
rm -rf ~/Library/Developer/Xcode/DerivedData
uninstalled xcode, npm, yarn, src code and rebooted. then installed everything back again.
any help?
this solved it. check the crash log.
~/Library/Logs/DiagnosticReports
App crashes when launching directly from simulator but If I launch our app in the simulator from Xcode via the play button it runs just fine
I was working on a React Native project with a group and was asked to use the iPhone 13 simulator as a model while working. I only had access to the iPhone 12 simulator, and I saw that my XCode was a version behind, so I updated it. Now with the new XCode, I am getting an error when I start the React Native server and try and open the iOS simulator. the error is shown below:
Running this command with the suggested build with -s Assertions=1 reveals the following:
My package.json is as following:
Any idea what is going on or how to proceed? Expo seems to be able to run, but trying to open the simulator crashes the server. The project I am on is near tight deadlines and I am totally held up by this. Either a way to troubleshoot this error or a way to roll back my XCode install and just live with a dated simulator would be greatly appreciated.
Figured it our thanks to ShepSims from https://github.com/expo/expo-cli/issues/2413 . Before being able to open the iOS simulator from the terminal, I needed to open XCode and open the simulator there. This mounts the simulator bundle, allowing later access by pressing i after running expo start.
I was receiving the same error as above with XCode command line tools installed only, no XCode installed.
I tried re-installing XCode command line tools which didn't do anything.
For me this was solved with advice mentioned at https://github.com/expo/expo-cli/issues/3871:
open Simulator.app, as it automatically sets the default device.
It is not anything. It was solved by opening simulator from XCOde on my mac
The fastest way from my point of view is "spotlight" (Cmd+Space) search for "Simulator", hit enter before running "expo start" in your terminal.
You can solve the problem by using this command
sudo expo start
Or
manually open simulator
start app: react-native run-ios
manually do: Hardware -> Device -> select iOS -> select Device (different than before !)
that will open a second simulator
start the app again: react-native run-ios (expo start then press i)
this opens the app in the selected simulator
Note:- please stay open the silumater then press the i in the expo and same for the react-native run-ios command
How can I open an existing Flutter project made by Android Studio on Mac-Os to export ipa version of app? Can it be done with Mac-Os version of Android Studio or I have to do it with X-Code? How?
Thanks in Advance
I could finally do that by accomplishing the following steps:
Copy the project into macOs (with X-Code Installed)
Open it by Android Studio (preferably latest version)
Enable Flutter and Dart plugin on Android Studio framework settings
Run command flutter packages get (Connection to Flutter repositories must be available)
Run flutter build ios --release as #Günter Zöchbauer truly commented
Connect iPhone device or simulator and run directly on your device
If some errors printed you may need to verify your developer account settings on X-Code or check Github page of your libraries for possible iOS issues
You can do it in XCode.
Ensure you run flutter build ios --release before you do.
Connection to physical iPhone device is not necessary. Run any sample project in xcode. Start a Simulator. (Only One simulator preferrably).
clone the repository from github into Mac (with X-Code Installed)
open terminal.
cd to your pubspec.yaml
flutter run (it will automatically run flutter pub get)
(It will launch on the already running iOS simulator)
follow steps on flutter.dev to install flutter. Above steps will only work from terminal if flutter doctor(any flutter command) is recognized
I just start learning react-native. when I trying to run the react-native run-android command it is showing error about android emulator.
Please help me to run my first react native app on Genymotion.
simple way:
first connect and android device or run an android emulator then do this steps
1- open android studio
2- click on File->open->navigate to to your react-native project and choose android folder
3- comeback to cmd and run react-antive order again
4- react-native run-android
in gradle-wrapper.properties change distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip
from 5.x
First of all you have to installed genymotion plugin on android studio. After that please run genymotion emulator.
And please open android studio and android project of created RN app.
The relevant gradle version will be downloaded and synchronized.
And then run command "react-native run-android".
Steps to setup for React Native with GenyMotion on MAC Machine
Installed Android Studio
Installed Genymotion
Pointed Genymotion settings custom SDK to: /Users/myusername/Library/Android/sdk
Added path to adb tool directory in .bash_profile to: PATH="/Users/myusername/Library/Android/sdk/platform-tools:${PATH}"
Restarted terminal for path to take effect
Ran exp path in terminal to copy path to exp
Ran adb in terminal to make sure it could find adb in platform-tools directory
Restarted Genymotion
Created and started virtual device in Genymotion
Started Expo XDE and started project
Ran Open on Android from XDE
App started on virtual device created in Genymotion (step 9)
after these steps,
on Terminal fire : npm run android
This has worked for me !