简体   繁体   English

Android Studio以风味设置应用程序名称

[英]Android Studio set application name in flavour

Building Your Project with Gradle shows how to create flavours of your app (as below). 使用Gradle建立专案会显示如何建立应用程式的风格(如下所示)。

Anyone knows how to set the application name for each flavour as well? 有人知道如何为每种口味设置应用程序名称吗?
eg for the demo version, show "my Demo" on the user's phone? 例如,对于演示版本,在用户的手机上显示“我的演示”?

...
android {
    ...
    defaultConfig { ... }
    signingConfigs { ... }
    buildTypes { ... }
    productFlavors {
        demo {
            packageName "com.buildsystemexample.app.demo"
            versionName "1.0-demo"
        }
        full {
            packageName "com.buildsystemexample.app.full"
            versionName "1.0-full"
        }
    }
}

In that same link, they define how to create different activities for each flavor. 在同一链接中,他们定义了如何为每种口味创建不同的活动。 Along with that, they define how to create separate strings.xml. 随之,他们定义了如何创建单独的strings.xml。 Basically follow their example on creating different strings.xml and you can define the application name in the xml. 基本上按照他们的示例创建不同的strings.xml,您可以在xml中定义应用程序名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM