Android为发布版和调试版构建了单独的字符串值 [英] Android separate string values for release and debug builds
问题描述
假设你使用Android Studio中,默认情况下,系统会创建一个基本的 所以你的结构应该是这样的: 我还应该补充一点,如果你有一个字符串在 Every time i release my app i change all my url strings and some keys from testing to production. The way I do it is just comment out the testing strings before i release. Is there a better way to handle strings based on the build type ? Assuming you use Android Studio, by default the system creates a basic So your structure should be like this: I should also add that if you have a string which isn't defined in either of the 这篇关于Android为发布版和调试版构建了单独的字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!版本
和调试
flavor。因此,如果您在 app / src $ c中添加
debug
和版本
文件夹
项目
-app
-src
-debug
-java
...
$ -res b $ b - 值
-strings.xml
- 释放
-java
...
-res
- 值
-strings .XML
-main
-java
...
-res
- 值
-strings.xml
debug
或发布
文件夹,它将回退到您的主要
文件夹。release
and debug
flavor. So if you add a debug
and release
folder in the app/src
folder of your project you can declare separate values there.project
-app
-src
-debug
-java
...
-res
-values
-strings.xml
-release
-java
...
-res
-values
-strings.xml
-main
-java
...
-res
-values
-strings.xml
debug
or the release
folder that it will fallback to your main
folder.