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

為什么構建類型與產品風味不同?

Why are build types distinct from product flavors?(為什么構建類型與產品風味不同?)
本文介紹了為什么構建類型與產品風味不同?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

前言:這不是關于如何在 Android 應用中使用構建類型和產品風格的問題.我了解所涉及的基本概念.這個問題更多是關于嘗試了解應該在構建類型中指定哪些配置,應該在產品風格中指定哪些配置,以及是否真的需要任何區別.

本周,我一直在學習有關 Android 應用的 gradle 配置的更多信息.我最初認為我對構建類型和產品風格有很好的處理,但我越深入文檔,我就越意識到兩者之間的區別對我來說根本不清楚.

This week, I've been learning more about gradle configuration for Android apps. I initially thought I had a good handle on build types vs product flavors, but the deeper I got into the documentation the more I realized the distinction between the two was not clear to me at all.

由于存在明確定義的層次結構(在某種意義上,構建類型中指定的屬性優先于產品風格中指定的屬性),我不明白為什么需要區分構建類型和產品風格全部.將所有屬性和方法合并到產品風味 DSL 對象中,然后將構建類型視為(默認)風味維度不是更好嗎?

Since there is a well-defined hierarchy (in the sense that properties specified in build types take precedence over those specified in product flavors), I don't understand why there is a need to distinguish between build types and product flavors at all. Would it not be better to merge all properties and methods into the product flavor DSL object, and then just treat build type as a (default) flavor dimension?

一些導致我困惑的具體例子:

Some concrete examples that led to my confusion:

  • signingConfig 屬性可以在構建類型和產品風格中設置...但是 minifyEnabled(并且,我假設,shr??inkResources?) 只能在構建類型中配置.

  • The signingConfig property can be set in both build types and product flavors... but minifyEnabled (and, I assume, shrinkResources?) can only be configured in build types.

applicationId 只能在產品風味中指定...而 applicationIdSuffix 只能在構建類型中指定!?

applicationId can only be specified in product flavors... and applicationIdSuffix can only be specified in build types!?

實際問題:

鑒于上述示例:構建類型與產品風格的角色之間是否有明顯區別?

Given the above examples: is there a clear distinction between the roles of build types vs product flavors?

如果是這樣,最好的理解方法是什么?

If so, what is the best way to understand it?

如果沒有,是否計劃最終將構建類型和產品風格合并到一個可配置的 DSL 對象中?

If not, is the plan to eventually merge build types and product flavors into a single configurable DSL object?

推薦答案

擴展 @CommonsWare 在評論中所說的內容,基本思想是構建類型適用于功能上沒有不同的應用程序的不同構建——如果你有你的應用程序的調試和發布版本,它們是同一個應用程序,但一個包含調試代碼,可能更多的日志記錄等,另一個經過簡化和優化,可能通過 ProGuard 混淆.使用風味,目的是應用程序在某些方面明顯不同.最明顯的例子是您的應用的免費版本和付費版本,但開發人員也可能會根據分發位置(這可能會影響應用內結算 API 的使用)進行區分.

Expanding on what @CommonsWare said in the comments, the basic idea is that build types are for different builds of your application that aren't functionally different -- if you have a debug and release version of your app, they're the same app, but one contains debugging code, maybe more logging, etc., and the other is streamlined and optimized and possibly obfuscated via ProGuard. With flavors, the intent is that the app is notably different in some way. The clearest example would be a free vs. a paid version of your app, but developers may also differentiate based on where it's being distributed (which could affect in-app billing API use).

有些開發人員為不同的客戶制作了許多不同版本的類似應用程序——例如,一個簡單的應用程序在網絡視圖中打開網頁,每個版本都有不同的 URL 和品牌——這是對風味的一種很好的利用.

There are developers that make many, many different versions of a similar app for different customers -- an example might be a simple app that opens up a web page in a web view, with different URLs and branding for each version -- this is a good use of flavors.

重申一下,如果它是相同的應用程序",請取模一些對最終用戶并不重要的差異,特別是如果除一個之外的所有變體都用于您自己的測試和開發用途并且只有一個變體將部署到最終用戶,那么它是構建類型的良好候選者.如果它是一個不同的"應用程序并且將向用戶部署多個變體,那么它可能是產品風格的候選者.

To reiterate, if it's "the same application", modulo some differences that aren't important to the end user, and especially if all of the variants except for one are for your own testing and development use and only one variant will be deployed to end users, then it's a good candidate for build types. If it's "a different" application and multiple variants would be deployed to users, then perhaps it's a candidate for a product flavor.

您已經看到構建類型和風格之間存在一些功能差異,其中一種支持某些選項,而另一種則不支持.但即使它們相似,概念也不同,并且沒有將它們合并在一起的計劃.

You've already seen that there are some functionality differences between build types and flavors, in that some options are supported for one but not the other. But the concepts are different even though they're similar, and there's no plan to merge them together.

這篇關于為什么構建類型與產品風味不同?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 国产91久久久久久久免费 | 精品1区| 亚洲福利网 | 黄色一级免费观看 | 欧美一级α片 | 久久av网站 | 91成人在线| 夜夜爆操 | 国产一二三视频在线观看 | 午夜在线免费观看 | 国产在线一区观看 | 日韩欧美中文 | 亚洲成人一区 | 97视频免费| 中文字幕一区二区三 | 亚洲高清一区二区三区 | 国产精品免费在线 | 亚洲少妇综合网 | 久久专区| 成人小视频在线观看 | 欧美日韩亚洲二区 | 欧美精品乱码久久久久久按摩 | 成人免费小视频 | 亚洲三区视频 | 亚洲综合在线视频 | 欧美一区永久视频免费观看 | 日韩在线电影 | 欧美日韩在线不卡 | 日本成人免费观看 | 九九热在线视频观看这里只有精品 | 色就是色欧美 | 国产精品久久久久久久久久久久久 | 九九亚洲 | 国产美女在线观看 | 一区二区三区在线免费 | 久久99精品国产 | 亚洲精品美女视频 | 在线观看亚洲精品视频 | 日本超碰 | 久久国产成人午夜av影院武则天 | 精品国产91亚洲一区二区三区www |