Skip to content

Instantly share code, notes, and snippets.

@ElianFabian
Created April 1, 2024 20:34
Show Gist options
  • Save ElianFabian/7aaf095931d57211dc085a296fbab49d to your computer and use it in GitHub Desktop.
Save ElianFabian/7aaf095931d57211dc085a296fbab49d to your computer and use it in GitHub Desktop.
How to read a property from local.properties file.
android {
namespace = ""
compileSdk = 34
defaultConfig {
applicationId = ""
minSdk = 21
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
val properties = Properties().apply {
load(rootProject.file("local.properties").inputStream())
}
resValue("string", "GoogleMapsApiKey", properties["GoogleMapsApiKey"] as String)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment