[英]Task 'installDebug' is ambiguous in project ':app' - React Native with android flavors
I am trying to run a react native app with the command: `react-native run-android –variant=devDebug``我正在尝试使用以下命令运行反应原生应用程序:`react-native run-android –variant=devDebug`
But I get the the error:但我得到了错误:
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
(node:20659) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/[username]/code/[app_name]/node_modules/tslib/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' is ambiguous in project ':app'. Candidates are: 'installDevDebug', 'installDevDebugAndroidTest', 'installProdDebug', 'installProdDebugAndroidTest', 'installStagingDebug', 'installStagingDebugAndroidTest'.
Indeed when I run gradlew tasks in the android folder of my project, I can't find installDebug.事实上,当我在项目的 android 文件夹中运行 gradlew 任务时,我找不到 installDebug。
I don't know what I am supposed to do to solve this situation.我不知道我应该做些什么来解决这种情况。
Some contex: I am trying to implement Android flavours, to install a dev and a prod app on the same phone/device.一些背景:我正在尝试实现 Android 风格,以在同一手机/设备上安装开发和产品应用程序。 When I remove the following in build.gradle, the command
react-native run-android
runs fine (without the --version param):当我在 build.gradle 中删除以下内容时,命令
react-native run-android
运行良好(没有 --version 参数):
flavorDimensions "env"
productFlavors {
dev {
resValue "string", "app_name", "MyApp Dev"
applicationIdSuffix ".dev"
}
staging {
resValue "string", "app_name", "MyApp Stag"
applicationIdSuffix ".stag"
}
prod {
resValue "string", "app_name", "MyApp"
}
}
Any idea?任何想法? Thanks a lot!
非常感谢!
Facing same issue with expo bare workflow when I am using this command当我使用此命令时,expo 裸工作流面临同样的问题
expo run:android --variant 'development'
and seeing the same error并看到同样的错误
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDevelopment' is ambiguous in project ':app'. Candidates are: 'installDevelopmentDebug', 'installDevelopmentDebugAndroidTest', 'installDevelopmentRelease'
So I tried with expo run:android --variant 'developmentDebug'
and that worked and didn't received the ambiguous error.所以我尝试使用
expo run:android --variant 'developmentDebug'
并且有效并且没有收到模棱两可的错误。 I suppose as each flavour can have debug
and release
build type, we need to tell it clearly which one we want.我想由于每种风格都可以有
debug
和release
构建类型,我们需要清楚地告诉它我们想要哪一种。
However, in case of expo I received another error after that但是,在 expo 的情况下,之后我收到另一个错误
Couldn't start project on Android: Error running adb: The development client (<package>) for this project is not installed. Please build and install the client on the device first.
Learn more: https://docs.expo.dev/clients/distribution-for-android/
I am also facing same issue reactnative old version.like this我也面临同样的问题 reactnative old version.like this
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.