使用 Gradle 實現 debug 與 release 不同 APP 名

出自Silica Library | 間奏時光
於 2020年3月21日 (六) 16:25 由 Silica留言 | 貢獻 所做的修訂 (创建页面,内容为“Category:Android 2020-03-22 00:15 == 使用 == <pre> android { ... buildTypes { debug { resValue "string", "app_name", "@string/app_…”)
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
跳至導覽 跳至搜尋

2020-03-22 00:15

使用

android {
    ...
    buildTypes {
        debug {
            resValue "string", "app_name", "@string/app_name_debug"
            ...
        }
        release {
            resValue "string", "app_name", "@string/app_name_release"
            ...
        }
    }
}

  在 strings.xml 中建立對應的 app_name_debug 和 app_name_release,通過 Gradle 打包出來的 debug 和 release 的同個 APP 就會不同名字。