The steps invole:
Open VS code as administrator.
yarn clean:android to clean the project
yarn android
It does the configuration and installs the app in my phone, but the moment the app launches in my phone, it terminates and there is no error shown in the terminal. [This is the error it shows on my phone](https://i.stack.imgur.com/IIEM6.png)
I tried to clean the app and the modules. The app is working in my other colleuges phones with the same configurations.
I was expecting it would work in my phone as well for testing purposes.
Related
NOTES: Im new in react native and i see there are so many approaches and with this error i thought the developer who built this app build it differently from what i learn so i don't understand why he didn't put the android folder
so i just joined a project and im going to run the apps in my pc by cloning it from github but when i try to npx react-native run-android it failed to run and the log is like this
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.
info Run CLI with --verbose flag for more details.
the folder structure is like this
The files show that the project is created with Expo. Specifically, you have a managed expo project.
npx react-native run-android would compile an android app from source, with Expo's managed workflow that's not needed. You will need the Expo Go App.
Expo also comes with its own commands to start the bundler. Instead of running npx react-native ... make use of the expo-cli running: npx expo start
However, in the package.json there is very likely a script called start. In that case, it's easier for you to run npm start.
After running this command the expo console opens. Here you can press a to open the app using expo go (or instructions on how to do so).
Alternatively, you can run npx expo run:android to start the expo go app on android yourself.
you are using an expo, there is a folder named .expo-shared, after
npm install
Try to run
npm start
or
expo start
or
npx expo start
something like this will appear:
https://imgur.com/U9I7Gf4
after that go to the terminal, open the emulator in you computer and click on the terminal and press 'a',
Code example I am trying to run: https://github.com/nshaposhnik/react-native-maps-example
I am on windows 10.
What I do:
Downloaded the code
Extracted to folder
Setup with the following after deleting yarn.lock:
yarn add react-native-maps
yarn add react-native-maps-directions
yarn add react-native-google-places-autocomplete
npm install
npm audit fix
Edit the code in the 3 places that requires my custom google API key which I got from the developer site
Tried running via:
npm start
I get a successful run in the terminal (" Welcome to React Native! Learn once, write anywhere"), but no browser opens up. I go to localhost:8081 in my browser and see a barren webpage with the following text:
React Native packager is running.
Visit documentation
That's all. Nothing in the sample project runs. I just want to run their app in a browser or emulator, though I don't have any of the phone emulators working, so I just want to run in web browser.
How can I make this work from the above example? Much appreciated.
You have to run emulator separately on "Windows" using android studio or command line, and after open your project using VsCode(or your editor) and the run following command ,
react-native run-android
Your app will run on your opened emulator
The app runs perfectly on an emulator from Android Studio, but returns
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment
When I run it from the CLI
I've tried rerunning the command and creating a new project
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment
Follow the steps below in order to solve the issue:
Go to the root project folder.
Find the Android project (which the Android Studio would recognize)
Open it on Android Studio and fix all the Gradle-related issues.
Once there is no more issue, close Android Studio and rerun the
react command.
I developed a react native app (version 57.4) on windows for android and it works fine.
Now I'm trying to build for iOS with no luck (as I don't have any experience with Xcode).
What I tried so far:
I knew that it requires a Mac and Xcode so I downloaded a VM, install Xcode.
Git clone myApp
react-native run-ios
But I got a lot of errors and build failures so after some search, I make these more steps:
react-native link
link some fonts manually
add a pod file and pod install
make some Xcode changes which I can't remember
react-native run-ios
And it works :)
BUT I had an issue with axios so I tried to fix it but I ruined the app so I removed the folder and re-cloned it again.
This time, I can't build successfully again!! and if it builds it crashes instantly!
My Question is what the exact steps do I need to make to build successfully on Mac (especially steps for Xcode)? including how to link all native dependencies correctly? and Is the pod file is necessary?
I am trying to run react native code but when I use react-native run-android I get this error message. I am using android studio.
~/Downloads/BrainG-master$ sudo react-native run-android
Scanning folders for symlinks in /home/luke/Downloads/BrainG-
master/node_modules (10ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew
installDebug)...
: No such file or directory
Could not install the app on the device, read the error above for
details.
Make sure you have an Android emulator running or a device connected
and have
set up your Android development environment:
Make sure
there is an android directory inside /Downloads/BrainG-master (I hope you're not running react-native run-android from within the android directory) and
your local.properties file in BrainG-master/android has the location of your android SDK specified in the following format: sdk.dir=/Users/username/pathToYourAndroidSdk.
If there is no local.properties file, open the project in Android Studio and it will create that for you.
If you're on Linux, you can also configure the android home environment thus:
Add the following lines to your $HOME/.bash_profile config file:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
.bash_profile is specific to bash. If you're using another shell, you will need to edit the appropriate shell-specific config file.
Type source $HOME/.bash_profile to load the config into your current shell. Verify that ANDROID_HOME has been added to your path by running echo $PATH.
You can follow the instructions here: https://facebook.github.io/react-native/docs/getting-started.html#2-install-the-android-sdk