首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在根项目'android‘React Native中找不到'installDebug’

在根项目'android‘React Native中找不到'installDebug’
EN

Stack Overflow用户
提问于 2016-08-24 17:22:26
回答 21查看 32.3K关注 0票数 28

我正试图在android模拟器上运行我的项目。当我运行react-native run-android时,我得到了以下信息:

代码语言:javascript
复制
FAILURE: Build failed with an exception.

* What went wrong: Task 'installDebug' not found in root project 'android'.

* 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.

BUILD FAILED

如果我运行./gradlew tasks,我会得到:

代码语言:javascript
复制
Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'android'.
components - Displays the components produced by root project 'android'. [incubating]
dependencies - Displays all dependencies declared in root project 'android'.
dependencyInsight - Displays the insight into a specific dependency in root project 'android'.
help - Displays a help message.
model - Displays the configuration model of root project 'android'. [incubating]
projects - Displays the sub-projects of root project 'android'.
properties - Displays the properties of root project 'android'.
tasks - Displays the tasks runnable from root project 'android'.

你知道为什么我的项目中没有installDebug任务吗?我怎么才能把它拿回来?

EN

回答 21

Stack Overflow用户

发布于 2017-05-12 10:46:49

react-native run-android --变体productFlavorName

例如,react-native run-android --变种华为run

票数 17
EN

Stack Overflow用户

发布于 2019-02-19 00:07:13

用于调试测试

react-native run-android --variant devKernelDebug

原因是因为在android/build.gradle文件中有这样的文件

代码语言:javascript
复制
  productFlavors {
    devKernel {
      dimension 'remoteKernel'
    }
    prodKernel {
      dimension 'remoteKernel'
    }
  }
票数 10
EN

Stack Overflow用户

发布于 2020-04-06 21:49:18

我在running react-native start之后的fresh react-native项目(react-native init projectname)中遇到了同样的问题,然后在VS代码中使用react-native run-android。它给出了这个错误

代码语言:javascript
复制
Task 'installDebug' not found in project ':app'.

在RN "0.62.1“中

解决方案:-我打开Android Studio,然后清理并重建。

我不确定在清理和重建后它是否会工作。

我也这样做了,并给出了根项目中的sdk路径

代码语言:javascript
复制
export ANDROID_HOME=/home/mycomputer/Android/Sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

然后它就起作用了。

我的npm版本6.7.0我的节点版本v11.10.1 react-native-cli: 2.0.1 react-native: 0.62.1

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39119301

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档