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
10年積累的成都網(wǎng)站制作、做網(wǎng)站經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有南安免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
Android studio 3.0上進(jìn)行多渠道打包時(shí)編譯時(shí)出現(xiàn)這個(gè)錯(cuò)誤
多渠道打包參考:https://www.jb51.net/article/127340.htm
解決問題參考:https://stackoverflow.com/questions/44105127/android-studio-3-0-flavor-dimension-issue
多渠道打包的細(xì)節(jié)我就不說了,參考網(wǎng)絡(luò)上的,或者我上面的這個(gè)鏈接就好,下面給出一下我修改的代碼(如果有其他的改法也希望能多多交流)
flavorDimensions "default" productFlavors { kuan { dimension "default" manifestPlaceholders = [UMENG_CHANNEL_VALUE: "kuan"] } xiaomi { dimension "default" manifestPlaceholders = [UMENG_CHANNEL_VALUE: "xiaomi"] } qh460 { dimension "default" manifestPlaceholders = [UMENG_CHANNEL_VALUE: "qh460"] } 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"} qh460 {dimension "default"} baidu {dimension "default"} wandoujia {dimension "default"} } productFlavors.all { flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] }
然后解決問題之后我又去官網(wǎng)查閱了一下,地址如下:
https://developer.android.com/studio/build/build-variants.html#flavor-dimensions
根據(jù)官網(wǎng)說法:
You must assign each product flavor you configure to one of the flavor dimensions.
你必須指定一種 flavor dimensions
void flavorDimensions(String... dimensions)
flavorDimensions 后面可以添加多個(gè)不同類型的參數(shù)例如:
flavorDimensions "api", "mode"
接下來的使用對(duì)應(yīng)起來就好了:
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多渠道打包的方式
總結(jié)
以上所述是小編給大家介紹的Android studio 3.0上進(jìn)行多渠道打包遇到的問題小結(jié)(超簡潔版),希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)創(chuàng)新互聯(lián)網(wǎng)站的支持!
分享題目:Androidstudio3.0上進(jìn)行多渠道打包遇到的問題小結(jié)(超簡潔版)
文章起源:http://chinadenli.net/article0/ppgpoo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、手機(jī)網(wǎng)站建設(shè)、做網(wǎng)站、靜態(tài)網(wǎng)站、網(wǎng)頁設(shè)計(jì)公司、微信公眾號(hào)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)