unresolved reference : BuildConfig in Kotlin

android, buildconfig, kotlin

Solution

If you are in 2023 or 2024 and having this issue, add

android.defaults.buildfeatures.buildconfig=true

to your `gradle.properties` file.

Problem

So I started a new android application, here is my Android Studio info ``` Android Studio 3.6.1 Build #AI-192.7142.36.36.6241897, built on February 27, 2020 Runtime version: 1.8.0_212-release-1586-b04 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 7 6.1 ``` I also added ``` buildConfigField "String", "MODE", "FREE" ``` in my product flavor. When I'm now getting this in my MainActivity's onCreate, ``` BuildConfig ``` is unresolved reference.

Original source

Related problems