Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 本机项目的生成失败_Android_React Native - Fatal编程技术网

Android 本机项目的生成失败

Android 本机项目的生成失败,android,react-native,Android,React Native,当我尝试构建react本机项目时,会发生以下错误: info Starting JS server... info Building and installing the app on the device (cd android && gradlew.bat ap p:installDebug)... FAILURE: Build failed with an exception. * What went wrong: A problem occurred configur

当我尝试构建react本机项目时,会发生以下错误:

info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat ap
p:installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment v
ariable or by setting the sdk.dir path in your project's local properties file a
t 'D:\COURSES\React Native - The Practical Guide\myFirstApp\android\local.proper
ties'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
error 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
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag
for more details.

由于此问题,我无法在Genymotion上运行该项目。

如错误消息中所述,没有安装Android SDK。尝试安装android SDK,并确保已定义并指向正确的目录


简单的方法是,尝试安装

您必须在react原生项目根目录下的local.properties文件中设置Android SDK的路径。我建议您看看这个问题的第二个答案

我安装了android studio,这发生了```>配置项目:应用程序检查C:\Users\BEn Hany\AppData\Local\android\SDK\licenses中的软件包android SDK构建工具28.0.3的许可证警告:不接受软件包android SDK构建工具28.0.3的许可证。正在检查C:\Users\BEn Hany\Ap pData\Local\Android\SDK\licenses中程序包Android SDK平台28的许可证警告:不接受程序包Android SDK平台28的许可证。失败:生成失败,出现异常```试着运行adroid studio,也试着创建新的简单android studio,然后运行它