installing reactnative for android on macOS Catlina - macos

i try to install reactnative today
been following tutorial from here : https://reactnative.dev/docs/environment-setup
when i try to run the test project
it failed to load emulator
chandra#MacBook-Pro-Chandra AwesomeProject % npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
can anyone help me please? thanks

You must create at least one AVD (Android Virtual Device) in order to run it in the emulator. It seems that you don't have any. An easy way to check is to run the following command:
emulator -list-avds
# Example output
Nougat_7
Pixel_2_API_29_Google_Play_
If the output of the command is empty, it means you don't have any AVDs yet. In this case you can create an AVD by opening Android Studio and then clicking the Configure menu and after that opening AVD Manager. In AVD Manager you can create a new virtual device which you can later run in the emulator.

Related

React Native Command "npx react-native start" does not work

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???

Flutter desktop embedding

Following these instructions
I tried to run a new project on macOS(desktop) using Android Studio.
I get the following error:
Launching lib/main.dart on macOS in release mode... Finished with
error: Unable to get Xcode project information: xcodebuild: error:
The directory
/Users/current.user/Work/Playground/testout/flutter_app2/macos does
not contain an Xcode project, workspace or package.
I get the same issue if I run in the terminal flutter run --release -d macOS
Running on a simulator/device, works fine.
It doesn't sound like you followed the instructions for running a project other than the FDE example. A newly created Flutter project doesn't have support for running on desktop; you need to add that.
See also flutter.dev/desktop#create for information on the state of create and run for desktop.

Nativescript - trying to run app on device connected to Mac (iOS)

I'm trying to run my app on a phone connected directly to the Mac.
tns run iOS
It's in debug mode - not. signed with production certs etc.
I'm getting the following error:
Unable to apply changes on device: 4d86dddfd4ec1ae761441ed5947acb7c143120e3. Error is: Command xcodebuild failed with exit code 65.
I can run on the emulator fine.
Any help?
Just had that error myself after attaching a new iphone to my computer.
I did tns platform remove ios and then tns platform add ios and it worked.
I had the same issue the last week. Exist some zombie processes and some weird ram issues related with that. I can't log everything :(
I did the following:
Check your current processes in Activity monitor and close everything for the first build.
Run: tns build ios --for-device --team-id TEAM_ID
After that, run: tns run ios --team-id TEAM_ID
Yes, foolish steps but works.
I'll put some logs here when I can.

react-native run-android not working and how to run it on genymotion

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 !

Nativescript - error on tns run android

I'm trying to run android emulator with the command tns run android. This starts the emulator but it keeps stuck on Android logo and I get the following error:
(...)
BUILD SUCCESSFUL
Total time: 17.013 secs
Project successfully built.
Using C:\(...)\sample-Groceries\platforms\android\build\outputs\apk\sampleGroceries-debug.apk
Starting Android emulator with image Nexus6
Waiting for emulator device initialization..............
Cannot run your app in the native emulator. Increase the timeout of the operation with the --timeout option or try to restart your adb
server with 'adb kill-server' command. Alternatively, run the Android
Virtual Device manager and increase the allocated RAM for the virtual
device.
(...)
Here is my Android Virtual Device configured:
AVD Manager
Note: I can run the application on my phone anyway, but not on my PC.
Finally I found the problem.
In Android Virtual Device Manager, there was an error I didn't see:
AVD Manager error
Here is a solution which I found to be useful.
enter image description here
You just have to manually activate the emulator, which you can do using android studio or command line. Using the command line, you have to run this command
emulator -avd avd_name [ {-option [value]} … ]
for ex:
/Android/sdk/emulator/emulator -avd test
Once the emulator starts you can run this command
tns run android
I started having similar issue after updating to the latest Android Studio and latest emulators. I switched the VM Heap to 64, and it worked for me. May be worth giving that a try.
Open your Android Virtual Device Manager and download the latest
emulator. That will fix the error.
I had the same problem. I fixed that by:
Open emulator manually from Android Studio (double-click on position in AVD Manager list)
Run tns run android
Works for macOS Sierra.

Resources