任务 'installDebug' 未在项目“:app”中找到。仅在一个 react-native 项目中
Task 'installDebug' not found in project ':app'.in only one react-native project
我是 React 的新手,第一次尝试做一个 Hello World 项目。我得到了提到的错误,还有错误,即我的 sdk 路径未设置。所以我配置了一个ANDROID_SDK_ROOT
变量。然后就正常了
现在我想在我的 android 设备上 运行 来自 github 的火箭聊天应用程序。这是项目:https://github.com/RocketChat.
导航到项目(root)后,我首先使用 npm start
启动服务器,显示一条成功消息。然后我想 运行 它在我的 phone 上,使用 npx react-native run-android
.
这是我得到的输出:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 5s
error Failed to install the app. Make sure you have the Android development environment set up:
https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
我知道已经有一些关于这个错误的帖子,到目前为止我尝试了他们的解决方案,但还没有成功。
我的设备已注册并在我注册时显示 adb devices
。全局 android sdk 变量也已设置。
可能出了什么问题?有人可以告诉我我缺少什么吗?
感谢您的帮助!
我修好了。 None 的解决方案有效,但我找到了另一种方法。
首先,不要忘记启动服务器。导航到项目的根文件夹和 运行 npm start
。这应该 运行 成功。如果它说您的端口已被使用,只需打开您的任务管理器并终止来自 NodeJS 的所有任务。
在您的 android 文件夹中,运行 命令 gradlew tasks
。这将向您显示可用命令的列表。我不知道为什么,但是命令 installDebug
不存在,因此出现错误。
但还有其他任务听起来很相似,例如 installFossDebug
。
所以我运行npx react-native run-android --variant=installFossDebug
。但它没有用。控制台向我显示了一个新错误,显示 Task installInstallFossDebug could not be found
(无错字)。
我不知道为什么 install
在任务中出现了两次,所以我只是 运行 npx react-native run-android --variant=FossDebug
瞧,它成功了。该应用程序在我的 android 设备上成功启动。
祝你好运! :-)
我是 React 的新手,第一次尝试做一个 Hello World 项目。我得到了提到的错误,还有错误,即我的 sdk 路径未设置。所以我配置了一个ANDROID_SDK_ROOT
变量。然后就正常了
现在我想在我的 android 设备上 运行 来自 github 的火箭聊天应用程序。这是项目:https://github.com/RocketChat.
导航到项目(root)后,我首先使用 npm start
启动服务器,显示一条成功消息。然后我想 运行 它在我的 phone 上,使用 npx react-native run-android
.
这是我得到的输出:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 5s
error Failed to install the app. Make sure you have the Android development environment set up:
https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
我知道已经有一些关于这个错误的帖子,到目前为止我尝试了他们的解决方案,但还没有成功。
我的设备已注册并在我注册时显示 adb devices
。全局 android sdk 变量也已设置。
可能出了什么问题?有人可以告诉我我缺少什么吗?
感谢您的帮助!
我修好了。 None 的解决方案有效,但我找到了另一种方法。
首先,不要忘记启动服务器。导航到项目的根文件夹和 运行 npm start
。这应该 运行 成功。如果它说您的端口已被使用,只需打开您的任务管理器并终止来自 NodeJS 的所有任务。
在您的 android 文件夹中,运行 命令 gradlew tasks
。这将向您显示可用命令的列表。我不知道为什么,但是命令 installDebug
不存在,因此出现错误。
但还有其他任务听起来很相似,例如 installFossDebug
。
所以我运行npx react-native run-android --variant=installFossDebug
。但它没有用。控制台向我显示了一个新错误,显示 Task installInstallFossDebug could not be found
(无错字)。
我不知道为什么 install
在任务中出现了两次,所以我只是 运行 npx react-native run-android --variant=FossDebug
瞧,它成功了。该应用程序在我的 android 设备上成功启动。
祝你好运! :-)