![](/img/trans.png)
[英]How to set app_name based on built type and build flavor using gradle
[英]Android/Gradle: App name based on build type *and* product flavor
我有3種構建類型(調試,UAT和發布)和2種口味(國際和本地)。
我在名為“product_name.xml”的xml文件中定義了我的應用名稱:
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="app_title">Awesome App</string>
</resources>
我想根據構建變體(構建類型+風格)更改應用程序名稱。 例如:
等等。
我該怎么辦? 我見過的所有例子告訴我如何更改基礎上建立任何類型或味道,但兩者不名。
您可以為變體創建src文件夾,並將自定義字符串放在那里:
src
|-> InternationalDebug
| |->res/values/strings.xml <-- place your app_title here
|-> LocalUAT
| |->res/values/strings.xml <-- place your app_title here
|-> main (contains your main source code.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.