androidflutterandroid-studio

A problem occurred configuring project ':firebase_core'


I am experiencing this problem when building the mobile / android flutter app, kindly help:

[ +271 ms] > Configure project :firebase_core
[        ] Evaluating project ':firebase_core' using build file 'C:\Users\kelsey\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_core-2.4.0\android\build.gradle'.
[        ] Using default execution profile
[        ] Could not execute [class org.jetbrains.kotlin.gradle.plugin.statistics.KotlinBuildStatHandler.buildFinished]
[   +2 ms] FAILURE: Build failed with an exception.
[   +3 ms] * What went wrong:
[        ] A problem occurred configuring project ':firebase_core'.
[   +1 ms] > com.android.builder.errors.EvalIssueException: defaultConfig contains custom BuildConfig fields, but the feature is disabled.
[   +1 ms] * Try:
[   +4 ms] > Run with --debug option to get more log output.
[   +1 ms] > Run with --scan to get full insights.
[        ] * Exception is:
[        ] org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':firebase_core'.

[        ] Caused by: com.android.builder.errors.EvalIssueException: defaultConfig contains custom BuildConfig fields, but the feature is disabled.
[        ]  at com.android.builder.errors.IssueReporter.reportError(IssueReporter.kt:113)

Solution

  • I think this issue is due to the deprecation of buildConfigField (from android.packageBuildConfig).

    Try adding the following line to gradle.properties:

    android.defaults.buildfeatures.buildconfig=true
    

    Also, note that this is a temporary solution until the firebase_core package resolves the issue.