久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Gradle中基于構(gòu)建變體的不同drawable

Different drawable based on build variant in Gradle(Gradle中基于構(gòu)建變體的不同drawable)
本文介紹了Gradle中基于構(gòu)建變體的不同drawable的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我的 gradle 文件中有兩種風(fēng)味:風(fēng)味 1 和風(fēng)味 2.除了構(gòu)建類型,他們還創(chuàng)建了以下構(gòu)建變體:

I have two flavors in my gradle file: flavor1 and flavor2. Along with the build types, they create the following build variants:

flavor1-debug
flavor1-release
flavor2-debug
flavor2-debug

假設(shè)我想為每個(gè)變體設(shè)置不同的可繪制對(duì)象,我應(yīng)該把它放在哪里?

Assuming I want to have a different drawable for each variant, where should I put it?

我的文件夾結(jié)構(gòu)是

src
 |__ main
 |__ flavor1
 |__ flavor2
 |__ debug
 |__ release

我知道,根據(jù) 這個(gè)那個(gè)

所有資源(Android res 和 assets)都使用覆蓋優(yōu)先級(jí)其中 Build Type 覆蓋 Product Flavor,Product Flavor 覆蓋主源集.

All resources (Android res and assets) are used using overlay priority where the Build Type overrides the Product Flavor, which overrides the main sourceSet.

這意味著如果我將它放在 Build Type 文件夾中,那么調(diào)試變體將具有相同的 debug drawable,而發(fā)布變體將具有相同的 release drawable.

This means however that if I put it in the Build Type folder, then the debug variants will have the same debug drawable and the release variants will have the same release drawable.

我想我可以從一開始就創(chuàng)造出更具體的口味,例如flavor1release、flavor1debug、flavor2release、flavor2debug,但我最終會(huì)得到 8 個(gè)變體.我可能無法根據(jù) this 構(gòu)建某些構(gòu)建類型,但這似乎不是很干凈.

I guess I could create more specific flavors from the beginning, e.g. flavor1release, flavor1debug, flavor2release, flavor2debug, but I would end up with 8 variants. I could probably not build some of the build types according to this, but that doesn't seem very clean.

推薦答案

實(shí)際上還有其他可用的源集.你可以這樣做:

There are actually additional sourceSets that are available. You can do this:

src
 |__ main
 |__ flavor1
 |__ flavor1Debug
 |__ flavor1Release
 |__ flavor2
 |__ flavor2Debug
 |__ flavor2Release
 |__ debug
 |__ release

我認(rèn)為它會(huì)給你你想要的——在一個(gè)風(fēng)味 + 構(gòu)建類型文件夾中,你可以在適當(dāng)?shù)馁Y源子目錄中擁有你的特定于變體的資源.

which I think will give you what you want -- inside one of the flavor + build type folders, you can have your variant-specific resource in the appropriate resource subdirectory.

請(qǐng)參閱 http://tools 上的文檔.android.com/tech-docs/new-build-system/user-guide#TOC-Sourcesets-and-Dependencies 了解更多信息.

See the docs at http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Sourcesets-and-Dependencies for more information.

這篇關(guān)于Gradle中基于構(gòu)建變體的不同drawable的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現(xiàn) IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當(dāng)前風(fēng)味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復(fù)“意外元素lt;查詢gt;在“清單中找到錯(cuò)誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風(fēng)味庫的多風(fēng)味應(yīng)用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運(yùn)行時(shí)有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 免费观看一级特黄欧美大片 | 国产欧美性成人精品午夜 | 黑人巨大精品欧美一区二区免费 | 日本一本在线 | 成人精品一区二区三区中文字幕 | 免费视频久久久久 | 亚洲精品一区二区三区中文字幕 | aaa精品| 亚洲国产第一页 | 亚洲国产一区二区在线 | 国产精品美女久久久久久久网站 | 日本xx视频免费观看 | 福利网站在线观看 | 亚洲成人一区 | 国产一区二区在线视频 | 日本一区二区高清不卡 | 亚洲成av人片在线观看无码 | 高清视频一区二区三区 | 免费日韩av| 成年人网站在线观看视频 | 日本成人在线观看网站 | 日韩电影一区二区三区 | 久久伊人精品一区二区三区 | av在线免费观看网站 | av在线免费网 | 国产免费看 | www.夜夜骑.com | 亚洲精品视频观看 | 日日日操 | 天天综合网天天综合 | 亚洲欧美日韩在线一区二区 | 成人免费看黄网站在线观看 | 久久午夜视频 | 中文一区二区 | 成人免费在线观看视频 | 国产一区二区三区在线 | 亚洲区视频| 人人干视频在线 | 欧美一区二区大片 | 亚洲国产成人在线观看 | 午夜精品久久久久久久久久久久 |