[英]I can't run my react native code even though I have an emulator running in the back round
I am trying to run react native code but when I use react-native run-android I get this error message. 我正在尝试运行React本机代码,但是当我使用react-native run-android时,出现此错误消息。 I am using android studio.
我正在使用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 /Downloads/BrainG-master
有一个android
目录(我希望您不要从android目录中运行react-native run-android
),
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
. BrainG-master/android
中的local.properties
文件以以下格式指定了android SDK的位置: 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. 如果没有
local.properties
文件,请在Android Studio中打开该项目,它将为您创建该项目。
If you're on Linux, you can also configure the android home environment thus: 如果您使用的是Linux,则还可以这样配置android家庭环境:
Add the following lines to your $HOME/.bash_profile config file:
将以下行添加到$ HOME / .bash_profile配置文件中:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
.bash_profile
is specific tobash
..bash_profile
特定于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.键入source
$HOME/.bash_profile
以将配置加载到当前的shell中。 Verify thatANDROID_HOME
has been added to your path by runningecho $PATH
.通过运行
echo $PATH
验证是否已将ANDROID_HOME
添加到您的路径。
You can follow the instructions here: https://facebook.github.io/react-native/docs/getting-started.html#2-install-the-android-sdk 您可以按照以下说明进行操作: https : //facebook.github.io/react-native/docs/getting-started.html#2-install-the-android-sdk
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.