Android studio 3.0上进行多渠道打包遇到的问题小结(超简洁版)
error:all flavors must now belong to a named flavor dimension. the flavor 'xiaomi' is not assigned to a flavor dimension. learn more at https://d.android.com/r/tools/flavordimensions-missing-error-message.html
android studio 3.0上进行多渠道打包时编译时出现这个错误
多渠道打包参考:
解决问题参考:
多渠道打包的细节我就不说了,参考网络上的,或者我上面的这个链接就好,下面给出一下我修改的代码(如果有其他的改法也希望能多多交流)
flavordimensions "default" productflavors { kuan { dimension "default" manifestplaceholders = [umeng_channel_value: "kuan"] } xiaomi { dimension "default" manifestplaceholders = [umeng_channel_value: "xiaomi"] } qh360 { dimension "default" manifestplaceholders = [umeng_channel_value: "qh360"] } baidu { dimension "default" manifestplaceholders = [umeng_channel_value: "baidu"] } wandoujia { dimension "default" manifestplaceholders = [umeng_channel_value: "wandoujia"] } }
或者:
flavordimensions "default" productflavors { kuan {dimension "default"} xiaomi {dimension "default"} qh360 {dimension "default"} baidu {dimension "default"} wandoujia {dimension "default"} } productflavors.all { flavor -> flavor.manifestplaceholders = [umeng_channel_value: name] }
然后解决问题之后我又去官网查阅了一下,地址如下:
根据官网说法:
you must assign each product flavor you configure to one of the flavor dimensions.
你必须指定一种 flavor dimensions
void flavordimensions(string... dimensions)
flavordimensions 后面可以添加多个不同类型的参数例如:
flavordimensions "api", "mode"
接下来的使用对应起来就好了:
productflavors { demo { // assigns this product flavor to the "mode" flavor dimension. dimension "mode" ... } full { dimension "mode" ... } // configurations in the "api" product flavors override those in "mode" // flavors and the defaultconfig {} block. gradle determines the priority // between flavor dimensions based on the order in which they appear next // to the flavordimensions property above--the first dimension has a higher // priority than the second, and so on. minapi24 { dimension "api" minsdkversion '24' // to ensure the target device receives the version of the app with // the highest compatible api level, assign version codes in increasing // value with api level. to learn more about assigning version codes to // support app updates and uploading to google play, read multiple apk support versioncode 30000 + android.defaultconfig.versioncode versionnamesuffix "-minapi24" ... } minapi23 { dimension "api" minsdkversion '23' versioncode 20000 + android.defaultconfig.versioncode versionnamesuffix "-minapi23" ... } minapi21 { dimension "api" minsdkversion '21' versioncode 10000 + android.defaultconfig.versioncode versionnamesuffix "-minapi21" ... } }
好了,这就是官方给出的gradle多渠道打包的方式
总结
以上所述是小编给大家介绍的android studio 3.0上进行多渠道打包遇到的问题小结(超简洁版),希望对大家有所帮助
上一篇: 可以查询google排名的asp源码
下一篇: VBScript中变量作用域