I have created a fresh React Native project using expo init RNCourse-Bare, I'm following expo bare approach. I haven't changed anything in the project, just tried to run it against Virtual Device using npm run android --info command, here's my output:
And here's my .bash_profile:
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=$PATH:ANDROID_SDK_ROOT/emulator
export PATH=$PATH:ANDROID_SDK_ROOT/platform-tools
And here's my Virtual Device:
Also, I have 2 versions of SDK installed:
android-31
android-33-ext
Any ideas?
Restarting my laptop solved the issue
Related
Hello friends pls I have been stuck on this 😔 error for the past weeks I'm trying to run a React native cli project on my Windows laptop and after following the documentation on the official create React native website I still get this error I have already downloaded and installed my android studio and my virtual device is up and running but for some reason I whenever I try to run "npx react-native run-android " after a while this error shows up
This my first working on a React native cli project
I ran npx react-native init app3
And
I have configured my Path and Android_Home environment variables as you can see it's still showing on my command prompt and powershell
I'm using a
Node version 16.13.0
Npm version 8.1.0
Javac version 17.0.1
And I'm relatively new to mobile development
Is used the the
Echo %ANDROID_HOME%
echo %PATH%
Command to check the Android_Home And Path location on my system
And it was as follows
C:\Users\andre\AppData\Local\Android\Sdk
C:\Users\andre\AppData\Local\Android\Sdk\platform-tools
I'm trying to run our react native app in Android emulator, after yarn android the Emulator starts but the app doesn't and after a few seconds I get the following error:
yarn run v1.22.10
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1755 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
error 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.
Error: spawn ./gradlew EACCES
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The project runs perfectly in XCode (ios), also in my colleague's laptop (with Windows).
I'm using a Macbook Air m1, macOS 11.3.1, SDK Platform: Android S, Android Studio 4.2.2, yarn version v1.22.10, node v15.12.0,
Here might be a react-native configuration issue with the current development environment on your system.
Please have a close look at the official docs to set up the environment.
React native Docs
First of all, make sure you have your Android Environment setup correctly.
To verify run
echo $ANDROID_HOME
echo $PATH
and make sure both have the correct path to your Android SDK.
If it's not correct, you have to set up your Android Environment
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Reference react-native-official-setup-guide
Other than that, the major issue which I see is related to Macbook Air M1, I just face a similar issue, M1 doesn't support VT-X.
To make sure that, your Macbook Air M1 supports VT-X open Android Studio and then AVD Manager.
Example (My Macbook) (Marked in PURPLE Box, VT-X is not supported)
Solution to this:
Download new emulator from android-emulator-apple-silicon-preview
This should enable developers to test/run ARM64 apps via ARM64 hardware virtualization.
For the "Error: spawn ./gradlew EACCES at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)".
Please try to input:
chmod 755 android/gradlew
in the root directory of the project. Then:
npx react-native run-android
Hi, I am using Android Studio to run React Native. However, I am not able to see the change after running command "npm run android" inside the folder that contains all the files (App.js). I am stuck with this instruction screen and don't know how to fix it.
Thank you.
Run: npm install -g react-native-cli
then , run : react-native run-android
Please note I have read the documentation and I'm referencing the point where the error happens as well as the steps I have taken. Please don't advice me to follow the instructions that I have already indicated I have followed.
After following the documentation of React Native to the best of my ability, I have been unable to get React Native to run. I have installed jdk, node, and Android Studio as instructed (using Chocolatey and links). The Android Emulator runs from Android Studio. I'm using npm version 6.1.0, node version 8.4.0, jdk 8, Android Studio 3.1.3. The error I get after react-native init AwesomeProject is SyntaxError: Unexpected token import. What did I do wrong? How can I fix this? Running react-native run-android also gives the same error.
To be clear, I'm in the proper directory. ANDROID_HOME is set to the proper sdk folder. There is a heading, Running your React Native application, and running the first command leaves me with the error, but I don't get an error before that point.
install npm
install react native cli => npm install -g
react-native-cli && npm install -g react-native (admin or sudo)
react-native init MyProject
cd Myproject
react-native run-ios or run-android
Update node to the latest version.
npm install -g react-native-cli.
npx react-native init newProject.
Since you install react native globally you don't need to use npx packages anymore just try
react-native init newProject
Assuming that you have Node 14 LTS or greater installed, you can use npm to install the Expo CLI command line utility:
npm install -g expo-cli
Then run the following commands to create a new React Native project called "AwesomeProject":
expo init AwesomeProject
cd AwesomeProject
npm start
Source: React Native Environment Setup
I just started learning react native. I am following this tutorial to set up my environment: https://www.raywenderlich.com/178012/react-native-tutorial-building-android-apps-javascript
Everything seems okay until the point where I have to run 'react-native run-android'. I get the error below:
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
What went wrong:
Could not determine java version from '9.0.4'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
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:
https://facebook.github.io/react-native/docs/getting-started.html
I have both JAVA 8 and 9 installed but I am pointing to Java 8. This is what $JAVA_HOME returns when I echo:
"/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java"
Note, I have an emulator running too.
Have you tried to do what s on this link below as-well:
https://facebook.github.io/react-native/docs/getting-started.html
This page will help you install and build your first React Native app.
The commands:
$npm install -g create-react-native-app
$create-react-native-app AwesomeProject
$cd AwesomeProject
$npm start
(I also tried a Youtube video regarding how to start and run a project on Ubuntu : https://www.youtube.com/watch?v=OZ5nCNOzflM )
I did it myself and for me it worked, at least for what I showed above.
This part is about building projects with React Native:
https://facebook.github.io/react-native/docs/getting-started.html
Commands :
$npm install -g react-native-cli
Install JS needed:
Add the following lines to your $HOME/.bash_profile config file:
export JAVASCRIPT_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Create project:
$react-native init AwesomeProject
Run:
$cd AwesomeProject
$react-native run-android
Let me know if I was of any help or not.
I am also trying to integrate Boilerplate for Android using React Native on a Linux Platform (Ubuntu) and I still didn t find a solution to do that, except what I described above.
Good Luck :)