React Native开发报错Task 'installDebug' not found in project ':app'.的解决办法

场景描述:
在配置好Android自动打包后,使用Android Studio是可以正常运行的,但是使用react-native run-android运行会报错:Task 'installDebug' not found in project ':app'.

报错信息

解决办法:
使用react-native run-android --variant channel01Debug运行,channel01Debug中的channel01为配置自动打包时的其中一个渠道,例如下面的配置,安装时可以把channel01Debug替换为channel02Debug或channel20Debug等。此时,设备上安装的就是对应渠道的apk。

productFlavors {
    channel01 {
        manifestPlaceholders = [UMENG_CHANNEL_VALUE: "渠道1"]
    }
    channel02 {
        manifestPlaceholders = [UMENG_CHANNEL_VALUE: "渠道2"]
    }
    ...
    channel20 {
        manifestPlaceholders = [UMENG_CHANNEL_VALUE: "渠道20"]
    }
    ...
}

参考地址:
https://blog.csdn.net/qq_31417381/article/details/86063695

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容