Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix error "Unresolved reference: BuildConfig"?

Tags:

android

gradle

After I added this piece of code into settings.gradle.kts the BuildConfig file is not being generated.

pluginManagement {
    repositories {
       google()
       gradlePluginPortal()
       mavenCentral()
    }
}

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.name = "Banking"
include(":app")

How can I make it be generated again? But I need to keep the code inside settings.gradle.kts.

Edit: I have already tried Invalidating caches and reloading the project.

like image 676
Tbijo54 Avatar asked Sep 13 '25 15:09

Tbijo54


1 Answers

When I faced this problem, adding the following code to the build.gradle of the app level helped me:

android {
    buildFeatures {
        buildConfig = true
    }
}

Or you can add the following the line in the gradle.properties file at the root project of your build:

android.defaults.buildfeatures.buildconfig=true
like image 71
Viktor Skliarov Avatar answered Sep 15 '25 04:09

Viktor Skliarov