I am new in RN, and frankly in any modern front-end tools. So, I am working on an existing project, where I just run
npx react-native start
to run the project from the terminal, when the packager has started, I run
npx react-native run-ios
on another terminal window, which pretty reluctantly starts the ios simulator and opens the app as well. but the problem occurs when I run
npx react-native run-android
on the same windows, it gives throws an error as given in the screenshot:
To solve the problem, I always open my Android Studio, and build and run the app, which runs the app in the android simulator.
But I would really appreciate if there are some JavaScript or RN geeks who can help me run the app in android by the command
npx react-native run-android
I run a mac, use VS Code, I have yarn, npm installed.
Just try to remove the virtual device from avd manager in android studio and recreate it again. I also faced this issue recently and this is how i solved it. Also, check for any available update in android studio build tools.
Related
I just want to know, Is there any way to run or test the IOS app in the windows emulator, I just want to test if my app can run in the IOS too using emulator etc., yet in my Android using npx react-native run-android it works fine and now I just want to test the command which is npx react-native run-ios but I think it only works at IOS instead windows, Is there any chance to run it in the emulator of android studio? or should I used VMWare?
I have already app using React Native -CLI and I want to test and run it on the IOS
A Mac is required to build projects with native code for iOS. You can follow the Expo CLI Quickstart to learn how to build your app using Expo instead.
React-Native Getting Started
I am using the React Native tutorial on the website to learn android development and also the ReactNative CLI. I'm using Android Studio as my preferred editor. When I try to run the default app generated by runinning npx react-native init AwesomeProject and npx react-native run-android, it says error Failed to launch emulator. Reason: Cannot Launch Google Pixel As ADB. I'm not sure what to do even though my emulator is working perfectly
I have got my expo project and I ran 'expo eject' to run it in the react-native CLI. It works on the iOS with some adjusting (thanks to the guys on GitHub) however I can't seem to get my android to work. It's saying
'Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.'
I have tried building a new react-native app (without using expo) and it works no problem.
To me the ejected project is not linking to the environment somewhere. I have tried updating android studio, going through the environment setup and update gradle (that caused more issues haha)
Has anybody else come across this please?
I have worked out the solution around this. Run these next steps soon after you do 'expo eject' (As it suggests in the console after eject runs)
Next steps
› 💡 You may want to run npx #react-native-community/cli doctor to help install any tools that your app may need to run your native projects.
› 🔑 Download your Android keystore (if you're not sure if you need to, just run the command and see): expo fetch:android:keystoreNext steps
I'm trying to run existing project with react-native start command. I run it in my main folder, where files like package.json, metro.config.js are located. The only thing I get is:
When I was looking at basic tutorials I notice that people get different output. In addition when I'm opening android folder in Android Studio and run this app I get:
My project structure looks like:
Can somebody help me with running this project?
EDIT1:
While trying to use react-native run-android I get:
Unrecognized command "run-android". Again after npm install I have:
To run the react-native project use
react-native run-android
Make sure your android device and laptop connected to the same network.
I've created a new React Native app with react-native init ProjectName and tried to run it within IntelliJ. For this I've created a new run configuration:
But after run this configuration, only react-native start is executed and not the actual start of the app (react-native run-android). Within a shell it's working, but not with IntelliJ and therefore debugging within IntelliJ is not readily possible.
I'm using the latest React Native version 0.50.1 and IntelliJ 2017.2.5.
Do you know such a problem and do you know how to fix it? For existing applications, it still worked, but not for new ones. After npm install it seems to be buggy also with existing projects.
Known issue, tracked as WEB-29569: the packager messages format has changed in react-native 0.50.*, and WebStorm can't parse the output and start the run command.
As a workaround, you can try downgrading react-native to 0.49.