본문 바로가기

소프트웨어 개발/Android

Using Java variables declared in Gradle

in build.gradle:

android {
buildTypes {
debug {
buildConfigField "int", "FOO", "100"
buildConfigField "String", "FOO_STRING", "\"foo\""
buildConfigField "boolean", "LOG", "true"
}

release {
buildConfigField "int", "FOO", "200"
buildConfigField "String", "FOO_STRING", "\"bar\""
buildConfigField "boolean", "LOG", "false"
}
}
}

You can access them with <module-dir>/app/build/generated/source/buildConfig/debug|release/<applicationId>/BuildConfig.java


'소프트웨어 개발 > Android' 카테고리의 다른 글

The map of Android UI/UX v0.3  (0) 2018.05.22
How to change the Button background color  (0) 2018.05.22