根据react本机文档,我已经安装了一个ndroid 8.0 (Oreo)和其余的说明。唯一的区别是我在.bashrc而不是.bash-profile中定义了路径变量。当我想运行我的反应本机应用程序时,我将面对Build failed with an exception.。
日志如下所示:
sudo react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.为我构建的项目不包含local.properties。但我已经有ANDROID_HOME了。
$ printenv | grep Android
ANDROID_HOME=/home/amir/Android/Sdk
PATH=/home/amir/Android/Sdk/tools:/home/amir/Android/Sdk/tools/bin:/home/amir/Android/Sdk/platform-tools:/home/amir/Android/Sdk/emulator发布于 2018-09-14 05:30:46
正如您提到的,默认情况下local.properties不存在,您应该将它添加到项目中。
用用户名替换USERNAME
现在,在您的终端中运行react-native run-android。
https://stackoverflow.com/questions/52323403
复制相似问题