kts 기준
local.properties
API_KEY="akldfjjasdfualksjdfalsdhfulaskjhd"
app/build.gradle.kts
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
android {
defaultConfig {
buildConfigField("String", "API_KEY", readProperty("API_KEY"))
}
}
fun readProperty(key: String): String = gradleLocalProperties(rootDir, providers).getProperty(key)
사용법
BuildConfig.API_KEY
Top comments (0)