简体   繁体   English

构建失败:React-Native

[英]Build Failed :React-Native

error Failed to install the app.错误 无法安装应用程序。 Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup .确保您已设置 Android 开发环境: https://reactnative.dev/docs/environment-setup Run CLI with --verbose flag for more details.使用 --verbose 标志运行 CLI 以获取更多详细信息。 Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081错误:命令失败:./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • What went wrong: Task 'installDebug' not found in project ':app'.出了什么问题:在项目“:app”中找不到任务“installDebug”。

  • Try: Run gradlew tasks to get a list of available tasks.尝试:运行 gradlew 任务以获取可用任务列表。 Run with --stacktrace option to get the stack trace.使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.使用 --info 或 --debug 选项运行以获得更多日志 output。 Run with --scan to get full insights.运行 --scan 以获得完整的见解。

  • Get more help at https://help.gradle.orghttps://help.gradle.org获得更多帮助

BUILD FAILED in 6s 6 秒内构建失败

at makeError (/home/te3t0/Desktop/testpro/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/home/te3t0/Desktop/testpro/node_modules/execa/index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)

MY OS = Ubuntu我的操作系统 = Ubuntu
IDE = Android Studio IDE = Android 工作室

react-native info react-native 信息

System:系统:

    OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i3-3110M CPU @ 2.40GHz
    Memory: 407.84 MB / 9.60 GB
    Shell: 5.0.16 - /bin/bash

Binaries:二进制文件:

    Node: 10.19.0 - /usr/bin/node
    Yarn: Not Found
    npm: 6.14.4 - /usr/bin/npm
    Watchman: Not Found

SDKs:开发工具包:

    Android SDK: Not Found

IDEs: IDE:

    Android Studio: Not Found

Languages:语言:

    Java: 1.8.0_252 - /usr/bin/javac
    Python: Not Found

npmPackages: npmPackages:

    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 

npmGlobalPackages: npmGlobalPackages:

    *react-native*: Not Found

You need to install Android SDK and Android Studio and Configure the ANDROID_HOME environment variable.您需要安装 Android SDK 和 Android Studio 并配置 ANDROID_HOME 环境变量。 Refer: https://reactnative.dev/docs/environment-setup参考: https://reactnative.dev/docs/environment-setup

Open Android Studio File -> Project Structure -> Gradle Settings -> Gradle JDK打开 Android Studio 文件 -> 项目结构 -> Gradle 设置 -> Gradle JDK

and set up as并设置为

Embedded JDK嵌入式 JDK

This worked for me after trying so many other options.在尝试了许多其他选择之后,这对我有用。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM