我正试图在android模拟器上运行我的项目。当我运行react-native run-android时,我得到了以下信息:
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,我会得到:
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任务吗?我怎么才能把它拿回来?
发布于 2017-05-12 10:46:49
react-native run-android --变体productFlavorName
例如,react-native run-android --变种华为run
发布于 2019-02-19 00:07:13
用于调试测试
react-native run-android --variant devKernelDebug
原因是因为在android/build.gradle文件中有这样的文件
productFlavors {
devKernel {
dimension 'remoteKernel'
}
prodKernel {
dimension 'remoteKernel'
}
}发布于 2020-04-06 21:49:18
我在running react-native start之后的fresh react-native项目(react-native init projectname)中遇到了同样的问题,然后在VS代码中使用react-native run-android。它给出了这个错误
Task 'installDebug' not found in project ':app'.在RN "0.62.1“中
解决方案:-我打开Android Studio,然后清理并重建。
我不确定在清理和重建后它是否会工作。
我也这样做了,并给出了根项目中的sdk路径
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
https://stackoverflow.com/questions/39119301
复制相似问题