【发布时间】:2017-08-25 18:34:48
【问题描述】:
我曾经在gradle中定义了一个应用名作为资源:
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "lelisoft.com.lelimath"
resValue 'string', 'app_name', 'LeliMath'
}
buildTypes {
debug {
applicationIdSuffix ".debug"
resValue 'string', 'app_name', 'LeliMath DEV'
}
}
然后我发现需要本地化,所以我从gradle中删除了所有resValue并在strings.xml中定义:
app\src\debug\res\values\strings.xml
<string name="app_name">LeliMath DEV</string>
app\src\main\res\values\strings.xml
<string name="app_name">Leli Math</string>
app\src\main\res\values-cs\strings.xml
<string name="app_name">Leli Matematika</string>
当我在 Studio 中编译我的应用程序时,它会显示 Leli Matematika。我期待 LeliMath DEV。我受到https://stackoverflow.com/a/37579475/1639556这个答案的启发。
【问题讨论】:
-
您为自定义位置创建了一个值目录。所以你必须在调试中创建相同的目录才能使其工作。看我的回答。
标签: android android-build android-build-flavors