AFAIK there are 2 possibilities:
.
├── app
│ ├── build.gradle
│ └── src
├── build.gradle
├── gradle
├── gradlew
├── gradlew.bat
├── settings.gradle
└── local.properties
with
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def sdkDir = properties.getProperty('sdk.dir')
def ndkDir = properties.getProperty('ndk.dir')
defaultConfig {
...
buildConfigField "String", "API_KEY", "\"${System.env.API_KEY}\""
}
println(BuildConfig.API_KEY)
What method should I use?
This is the Good Answer for your Question- Link
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.