当我尝试执行以下代码时,我的 react-native 应用程序出错 [英] I get error on my react-native app while I am trying to execute following code
问题描述
FAILURE:构建失败,出现异常.
FAILURE: Build failed with an exception.
出了什么问题:在项目:app"中找不到任务installDebug".
What went wrong: Task 'installDebug' not found in project ':app'.
试试:运行 gradlew tasks 以获取可用任务的列表.使用 --stacktrace 运行获取堆栈跟踪的选项.使用 --info 或 --debug 选项运行以获得更多日志输出.使用 --scan 运行以获得完整的见解.
Try: Run gradlew tasks to get a list of available tasks. 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.
推荐答案
在运行命令之前设置环境
遵循这些说明
brew 安装节点
brew install watchman
brew cask install applyopenjdk/openjdk/adoptopenjdk8
在提示选择安装类型时选择自定义"设置.确保选中以下所有旁边的框:
Choose a "Custom" setup when prompted to select an installation type. Make sure the boxes next to all of the following are checked:
- Android SDK
- Android SDK 平台
- 性能(英特尔® HAXM)
- Android 虚拟设备
将以下行添加到您的 $HOME/.bash_profile 或 $HOME/.bashrc 配置文件中:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
这篇关于当我尝试执行以下代码时,我的 react-native 应用程序出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!