Cannot open my new react-native app in emulator - react-native

I am a beginner in React-native
So i tried to start react-native.. I went to so many youtube tutorials and udemy courses..
At last i set up mu native environment.. start react-native
First i went on Getting Started React-Native site..
then i init awesomeproject to my local storage..
then run react-native run-android..
Emulator displayed correct output..
so i tried to do more projects and tried to learn react-native
so i init new project called "ChatApp"
using
react-native init ChatApp
project was successfully installed.
So again i tried to
cd ChatApp
then
react-native run-android
But still i get that old "awesomeapp"
I dont no what to do
I deleted chache memory and app in the emulator and i deleted sdk in android studio after that i again try to run the command still i get that older app..

I guess you meant cd ChatApp.
Otherwise, every new project you will create with the react-native init command will be exactly the same! If you made some modifications but the UI doesn't update, be sure that there is no other react-native instances running.

Related

Failed to intall the app in react native, how can I fix this?

I was trying execute myapp to android but an error occurred.
To clarify what happened, first time I install nodejs and Android Studio.
Later I used the following commands:
npx react-native init 'app'
cd app
npx react-native run-android
Its my fisrt time messing with react native, I was following this page:
https://learn.microsoft.com/pt-br/windows/dev-environment/javascript/react-native-for-android
And the error is:
The error
I want coding in real time for android app.
How can I fix this?
Looks like the terminal output gives you several steps to do/check.
Make sure you have properly set up your android environment. Use this link to do so. You can use Expo-Cli or React-Native-Cli.
SDK location not found. This could be an off-shoot error of not properly doing step 1. However, to cover all of your bases, ensure you have properly set up your Android Emulator. This doc is a great walkthrough.
Once your Android studio and AVD Manager is properly set up, and your development environment is properly set, you should have no issues!
Please let me know if doing the above to steps did or did not solve your errors.
If you follow the steps, https://reactnative.dev/docs/environment-setup and https://developer.android.com/studio/run/emulator there will be no problem.
As a React Native fan on Windows 10, I'd like to mention just few points you need to check.
First, please check following user variables in Environment Variables ( You can see it from System Properties).
adb="C:\Users{username}\AppData\Local\Android\Sdk\platform-tools"
ANDROID_HOME="C:\Users{username}\AppData\Local\Android\Sdk"
JAVA_HOME="C:\Program Files\OpenJDK\openjdk-11.0.15_10"
Path: check if contains {ANDROID_HOME}\platform-tools
Eg:"C:\Users{username}\AppData\Local\Android\Sdk\platform-tools"
Second, if you are using Android Sdk emulator, please make sure that it configured correctly in emulator list in Android Studio.
For an instance, I created a android emulator using android sdk-29 and you can check the followings.
Third, I recommend you, deploy first app on emulator in Android Studio.
Because we need to download gradle zip file and others, it's essential to run your first android app in Android Studio.
When you confirmed your first android app(Deploy empty project app is also okay), you can run your React Native App by Expo-cli or react-native-cli.

The Expo SDK requires Expo to run

I'm running my project on expo. After running expo eject, I'm getting the following error:
The Expo SDK requires Expo to run
Even for a brand new project I'm getting this error and I cannot do anything with expo anymore.
I run :
expo init Project1
and then going inside the Project1 direcotory and run:
expo start // and then click 'a' for running project on android emulator.
and emulator screen shows this error.
If you have logged into the command line on your computer, log out and try reloading the app. Otherwise reinstall expo and try again.

React Native not installing properly

I am familiar with React Native. I got a new macbook and I am trying to create a new file. However, when I run create-react-native-app [name of app] I am greeted with:
This command requires Expo CLI.
Do you want to install it globally [Y/n]?
When I pressed Y it created the file, however, in a complete file layout. It looked so odd and there were some files missing too.
Normally, when I run create-react-native-app it created the file without asking anything about expo. I am pretty confused. I'm pretty sure I have done wrong somewhere. Where and how I can get the traditional installation process back?
I also know that expo helps with testing. Since may I have been using npm start and npm run ios to test my apps on device and xcode simulation.
https://facebook.github.io/react-native/docs/getting-started I followed this.
New version out now and create react native app has been merged with expo CLI.
To avoid any bug use new version to create react apps, follow the command bellow which is also in the link given in your question.
expo init AwesomeProject
After installation you will be guided to start project with expo start.
cd AwesomeProject
expo start

Android Emulator Shows React Native Starter App Instead of Correct App

After an attempt to use the adb tool to pull an updated sqlite database to my android emulator, I am unable to run my app on that emulator. Instead of showing the main screen of my app, I get the "Welcome to React Native!" demo app. My source code does NOT contain this; all my App.js contains is a definition for a StackNavigator.
Here are the things I have tried in order to fix this:
Via the AVD console in Android Studio, delete and recreate the image (Nexus 5, Android 6 with Google API)
Via the same console, use the Wipe Data option to try to reset it to a blank state.
Various npm commands, such as clean cache.
In addition, when I attempt to run react-native run-android from the command line, it usually immediately exits after building the application.
Can anyone give me any idea what I can do just to simply run my app on the emulator?
App source is at https://github.com/fergusonjason/soccerstats if that is any help.
(Yes, I realize this sounds stupid. Why it would replace an app I've been working on for 3 weeks with the react-native starter app is beyond me).
Jason
Assuming your java script bundler is up and running with react-native start you can try to reload by running adb shell input keyevent KEYCODE_MENU in another terminal and pressing reload after the Dev Menu shows up in the emulator.
Then be sure to check in your terminal where you ran the start command, if the Bundling log shows up. If it doesn't shows up, then perhaps you have another bundler running, which needs to be terminated before you can run your project
After trying several things, I ended up forcing a rebuild of index.android.bundle:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
It's possible that I had never staged or committed any updates of this file to the github repo.
Thank you to Aureo Beck for attempting to help me.

Integrate viro-react into react-native project

Anyone here managed to integrate viro-react into react-native project? I followed the instruction in
the documentation
After that, I executed the project but not able to run.
This is the error that I got
Even though I run with gradlew installOvrDebug, still it failed.
If your configurations are correct then try running with any of these variants
ArDebug, GvrDebug or OvrDebug
Example running apllication with Augmented Reality:
Android
react-native run-android --variant=ArDebug
iOS
react-native run-ios --variant=ArDebug
I solved this problem with the following method:
Go to the Navigate to the node_modules/react-native/local-cli/runAndroid/runAndroid.js file and edit the lines that include installDebug change it to installArDebug
Go to the terminal and npm start
Open another terminal and react-native run-android
*Make sure that your device is plugged in and that you have android studio sdk paths in your environment variables. This should do the trick!