How to change app name per Gradle build type

前端 未结 10 872
慢半拍i
慢半拍i 2020-11-29 20:09

I am trying to figure out a way to be able to change my application\'s app name per build type in gradle.

For instance, I would like the debug version to have

10条回答
  •  孤城傲影
    2020-11-29 20:38

    If by "app name", you mean android:label on , the simplest solution is to have that point at a string resource (e.g., android:label="@string/app_name"), then have a different version of that string resource in a src/debug/ sourceset.

    You can see that in this sample project, where I have a replacement for app_name in src/debug/res/values/strings.xml, which will be applied for debug builds. release builds will use the version of app_name in src/main/.

提交回复
热议问题