「使用 Gradle 实现 debug 与 release 不同 APP 名」修訂間的差異

出自Silica Library | 間奏時光
跳至導覽 跳至搜尋
(创建页面,内容为“Category:Android 2020-03-22 00:15 == 使用 == <pre> android { ... buildTypes { debug { resValue "string", "app_name", "@string/app_…”)
 
 
行 8: 行 8:
    buildTypes {
    buildTypes {
      debug {
      debug {
        resValue "string", "app_name", "@string/app_name_debug"
        resValue "string", "app_name", "APP Debug Version"
        ...
        ...
      }
      }
      release {
      release {
        resValue "string", "app_name", "@string/app_name_release"
        resValue "string", "app_name", "APP Release Version"
        ...
        ...
      }
      }
行 19: 行 19:
</pre>
</pre>


   在 strings.xml 中 建立对应 app_name_debug 和 app_name_release 通过 Gradle  打包出 来的 debug 和 release 的同个 APP 就会不同名字 。<br>
    注意,记得 在 strings.xml 中 注释掉原有 app_name 条目 不然会 打包出 。<br>

於 2020年3月21日 (六) 16:34 的最新修訂

2020-03-22 00:15

使用

android {
    ...
    buildTypes {
        debug {
            resValue "string", "app_name", "APP Debug Version"
            ...
        }
        release {
            resValue "string", "app_name", "APP Release Version"
            ...
        }
    }
}

  注意,記得在 strings.xml 中注釋掉原有的 app_name 條目,不然會打包出錯。