React Native - Open Old Version Project (up to 0.48v) - android

I learning React-Native with Windows 10, Using Git Bash Command Prompt and Android Studio Emulator.
I have Install React Native globally by using npm install -g react-native-cli, I always create Project using react-native init ProjectName and
My Project Launching Method is
go into Project Directory with Git Bash CMD and execute react-native run-android.
I notice that most of the Project in Github are older version which consist of index.android.js and index.ios.js (My Project is newer version so it only have index.js). I been trying to open some older version Project, but it seem like it just does not launch with the method I mentioned above.
I also have tried react-native start method from How to open existing project in React Native? but I still not able to launch it.
The error message when I trying to launch the project is Command unrecognized. Make sure that you have run npm install and that you are inside a react-native project. This Problem only occur when I trying to launch project from Github, when I open my own Project there is no such problem.
ps. If I try use npm install in the project directory, it will have some error.
I have try to search from Net, most of their launching method are the same as above and does not work for me, so wanna ask that:
Is my method of launching React-Native is wrong in the very beginning?
Is there anything I need to install so that I can open old version React Native Project?
How can I open this project with my current situation? https://github.com/parkerdan/SampleNavigation
Thank you.
Extra Info (React Native CLI and Node Version):
$ react-native -v
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
> process.version
'v8.9.4' (Node Version)

After whole day of Searching, I have found the Solution.
Whenever open any Project from Github or any sources, we have to ensure that the we have install all the required Dependencies, as Most of the Project using different type of dependencies that you may have not ever install.
Solution:
Download project
git clone https://github.com/parkerdan/SampleNavigation.git
2. Go to the Project Directory and Install dependencies (IMPORTANT)
Note: For unknown reason, npm install does not work
npm i
or yarn i
Run Project (or any launch method that work you)
react-native run-android

After you clone your project from git and cd to project folder, make sure you run npm install before you can react-native run-android.

Related

How to run react-native application in android which is cloned from a github repository?

I was working on a local project from scratch which was not on github and it was running successfully. But when i clone a project from github and try to run on android, mostly (not every application cloned from github gives me this error but few big application gives) it gives me error like
Command That I run:
npx react-native run-android
Error that I get:
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
This is because you have to download the gradle files first before running it. Follow the steps and it will definitely run.
Step 1: Clone the project from github repo.
Step 2: Open it in any
code editor (I prefer VS code).
Step 3: Install node_modules by
running npm install command in terminal.
Step 4: Open android
studio and open the react-native-app/android folder inside it.
Note: Android Studio will automatically start downloading the gradle and build it, which you can see in bottom part of android studio.
Step 5: After gradle files are downloaded and build successfully, go back to the code editor and try to run your app again using
npx react-native run-android
Note: If it shows the same error restart your code editor or laptop and it will work like a charm.
make sure you have configure the environment of react native in your machine(desktop/laptop).
follow the link for environment Setup:
https://reactnative.dev/docs/environment-setup
after that follow below steps:
Clone the project from github.
cd projectName
npm install
npx react-native run-android
Clone the project and Open that folder
--> npm install
--> cd ios -> pod install
--> gradle wrapper
--> npx react-native run-android

error Android project not found. Are you sure this is a React Native project?

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

React-Native The system cannot find the file specified

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!

react-native run-android issue - error Android project not found

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

How to run/install the React Native official examples?

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

Categories

Resources