gradle8+ BuildConfig未生成

Build Type ‘release’ contains custom BuildConfig fields, but the feature is disabled.

在Gradle插件到达8后默认不会生成BuildConfig文件。
那要如何生成呢?
gradle.properties里更改:

android.defaults.buildfeatures.buildconfig=true

或者在项目build.gradle(不是顶级gradle)中更改:

    buildFeatures {
        buildConfig = true
        ...
    }

参照:https://stackoverflow.com/questions/74634321/fixing-the-build-type-contains-custom-buildconfig-fields-but-the-feature-is-di

你可能感兴趣的:(gradle,android,android,studio)