Can’t use def keyword in build.gradle.kts –> error: “Unresolved reference: def”

When I use this code in build.gradle.kts(:app), it gives this error: Unresolved reference: def

def apikeyPropertiesFile = rootProject.file("apikey.properties")
def apikeyPro = new Properties()
apikeyPro.load(new FileInputStream(apikeyPropertiesFile))

How can I use “def” in gradle?

Leave a Comment