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.
Related
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.
after serval days with react native and android running, I added some external libraries, and all was well.
After re-start of the computer, I got back to the root of the react native project and typed
npx react-native run-android
And got back the error msg
error Android project not found. Are you sure this is a React Native project? If your Android files are located in a non-standard location (e.g. not inside 'android' folder), consider setting `project.android.sourceDir` option to point to a new location. Run CLI with --verbose flag for more details.
my Android project is in standard location : MyReactProject\android.
Any ideas what happed or how to fix this?
I have found a solution that works, but it still don't know what went wrong.
probably from installing the new packages.
Open the Root Directory of my React Native Project
go to \android\app\build\intermediates\signing_config\debug\out
Delete the file signing-config.json
go back to Root Directory
type npx react-native run-android
the solution is based on this site, hope this will help others.
You should check your manifest
I did not have the tag closed
Just found the solution.
You just need to go to node_modules -> glob -> common.js
Find options.allowWindowsEscape and set it to false
It worked for me and it also took 3 hours to find the solution. Hope it will work for you as well.
Make sure you have "android" and "ios" folders in your project root directory exactly like below pictures shows. If you don't have these folders then create them.
npm i react-native-eject
npm i #react-native-community/cli
react-native eject
react-native upgrade
So Basically the Problem Could Be That You May be starting expo CLI quickstart Project in "React native CLI Quickstart" .
There are two ways :-
https://reactnative.dev/docs/environment-setup
the problem can be solved by :-
1)npm install -g expo-cli
2) expo init AwesomeProject
cd
npm start # you can also use: expo start
trying to run my first React-Native project but facing this error :
:ReactNative:Cannot run program "./node_modules/.bin/react-native" (in directory "C:\Users\abdul\AwesomeProject\android\.."): CreateProcess error=2, The system cannot find the file specified
:ReactNative:Automatic import of native modules failed.
Duplicate disclaimer : i read another question with the same title,
That question has a successful build result but in my case Build was not successful plus the accepted answer didn't work for me
OS:Windows 10.
yarn is used .
Android Studio:Exist with last SDK.
Setup: performed following docs
so what is the wrong i did?
Navigated into the project directory, try deleting node_modules and yarn.lock and re-running yarn install.
I managed to make it work by:
Uninstalled global react-native-cli
Created new project with npx react-native init MyApp
Started JS server with npx react-native start
Run in android emulator with npx react-native run-android
And it worked!
I create a react native app in C9. Now, I want to develop this app on my local machine with android settings. I downloaded the project.
cd myProjectFolder
react-native start
npm install
react-native run-android
Also, I add a project name in package.json.
The error is below:
error Android project not found. Are you sure this is a React Native project?
If android project/folder does not exit in your root project then run :
react-native eject
I encountered this issue after I ruan ./gradlew clean. Tried serval methods but vain. Then I ran ./gradlew in the Android directory. It worked for me.
// Android
./gradlew
For example, I'm trying to run the UIExplorer example.
I cloned the https://github.com/facebook/react-native/tree/master/ repository.
Did react-native init ExplorerApp
Copied everything inside the UIExplorerfolder and pasted it inside the ExplorerApp folder (except the android folder)
However, when I run ExplorerApp I still get "Welcome to React Native"!
Maybe I have to modify index.android.js so it somehow points to the pasted files? How to do that?
To run the official RN examples, follow these steps
git clone https://github.com/facebook/react-native.git
cd react-native && npm install
iOS
Now open any example (the .xcodeproj file in each of the Examples subdirectories) and hit Run in Xcode.
Android
You need to install Android NDK : see prerequisites here
To start the Movies Example :
./gradlew :Examples:Movies:android:app:installDebug
Start the packager in a separate shell (make sure you ran npm install):
./packager/packager.sh
Open the Movies app in your emulator