DEV Community

Beaver Bridge
Beaver Bridge

Posted on

local.properties의 값 가져오기

kts 기준

local.properties

API_KEY="akldfjjasdfualksjdfalsdhfulaskjhd"
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

사용법

BuildConfig.API_KEY
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Sentry growth stunted Image

If you are wasting time trying to track down the cause of a crash, it’s time for a better solution. Get your crash rates to zero (or close to zero as possible) with less time and effort.

Try Sentry for more visibility into crashes, better workflow tools, and customizable alerts and reporting.

Switch Tools

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay