如何在 android Activity 中使用 gradle.properties 中的属性?每当我构建代码时,它都会抛出错误。是否有特定的方式可以在 Activity 中访问属性?
最佳答案
在 gradle.properties 中:
SIMPLE_STRING=ABC
在 build.gradle 中:
android {
buildTypes {
debug {
buildConfigField 'boolean', 'PREPROD', 'true'
buildConfigField "String" , "MY_KEY" , SIMPLE_STRING
}
}
}
关于android - 如何在 android Activity 中使用 gradle.properties 中的属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34925101/