Colton Idle
10/25/2025, 2:50 AMBuildConfig to insert api keys and other values into my build to be able to access programatically. But in a plain' ol kotlin/java library there is no BuildConfig. I have seen some other libraries or plugins that attempt to be BuildConfig but in the regular library world but that just seems... off?ephemient
10/25/2025, 3:45 AMColton Idle
10/25/2025, 4:46 AMephemient
10/25/2025, 5:14 AMmbonnin
10/25/2025, 9:20 AMColton Idle
10/25/2025, 6:06 PMeygraber
10/25/2025, 11:43 PMephemient
10/26/2025, 5:19 AMColton Idle
10/26/2025, 5:28 AM./gradlew assembleRelease --with-api-key B and then locally (or by default) I'd have api-key A hardcoded.ephemient
10/26/2025, 5:29 AMColton Idle
10/26/2025, 7:11 AMeygraber
10/26/2025, 12:07 PMColton Idle
10/26/2025, 4:29 PMColton Idle
10/26/2025, 4:29 PMephemient
10/26/2025, 8:25 PMColton Idle
10/26/2025, 9:40 PMval API_KEY = System.getProperty("apiKey", "default")
and then when we build via cmd line we would do
/gradlew mylib:assembleRelease -DapiKey="prod api key"
still going to take some time on monday to read into the options aboveColton Idle
10/26/2025, 9:41 PMephemient
10/26/2025, 9:42 PMColton Idle
10/27/2025, 4:41 PMephemient
10/27/2025, 4:46 PMColton Idle
10/29/2025, 5:40 AMdefaultConfig {
val localProps = Properties().apply {
val file = rootProject.file("local.properties")
if (file.exists()) load(file.inputStream())
}
val apiKeyFromProps: String = localProps.getProperty("myApiKey") ?: "fallback-key"
resValue("string", "my_library_api_key", apiKeyFromProps)
}
then in my library code i can access it if i get a context passed into my sdk context.getString(<http://R.string.my|R.string.my>_library_api_key)Colton Idle
10/29/2025, 5:41 AMephemient
10/29/2025, 6:15 AM