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 tobash
. 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 thatANDROID_HOME
has been added to your path by runningecho $PATH
.
You can follow the instructions here: https://facebook.github.io/react-native/docs/getting-started.html#2-install-the-android-sdk
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.