问题描述
我有3种构建类型(debug,UAT和release)和2种flavor(国际化和本地化)。 我有我的应用程序名称定义在一个名为xml文件product_name.xml:
< resources xmlns:tools =http://schemas.android.com/tools
工具:ignore =MissingTranslation>
< string name =app_title> Awesome App< / string>
< /资源>
我想根据构建变体(构建类型+风格)更改应用程序名称。例如:
等等。
我该如何处理这件事?我见过的所有示例都向我展示了如何根据 构建类型或风格但 更改名称。
code> src
| - > InternationalDebug
| | - > res / values / strings.xml< - 将您的app_title放置在这里
| - > LocalUAT
| | - > res / values / strings.xml< - 将您的app_title放置在这里
| - > main(包含你的主要源代码)
I have 3 build types (debug, UAT and release) and 2 flavors (international and local).
I have my app name defined in a xml file named "product_name.xml":
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation">
<string name="app_title">Awesome App</string>
</resources>
I want to change the app name based on the build variant (build type + flavor). E.g:
- For variant InternationalDebug -> Awesome App (intl) debug
- For variant InternationalUAT -> Awesome App (intl) UAT
- For variant LocalUAT -> Awesome App (local) UAT
and so on.
How would I do about this? All the examples I've seen show me how to change the name based on either build type or the flavor but not both.
You could create src-folders for your variants and place your custom strings there:
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.
这篇关于Android / Gradle:基于构建类型*和*产品风格的应用程序名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!