Android Studio does not automatically generate BuildConfig files when creating projects

Today when I created a new project on AS, I found that the BuildConfig file could not be found, no matter how I cleared it, it didn't work. Through various searches, it was found that it was caused by different gradle versions. Gradle 8.0 does not generate BuildConfig files by default.

As shown above, version 8.0 does not have a source folder.

The picture above shows the source folder for versions lower than 8.0.

To solve this problem, there are two solutions.
       Method 1: Reduce the Gradle plug-in version.
       Method 2: Add the following code to gradle.properties and recompile.
android.defaults.buildfeatures.buildconfig=true

Guess you like

Origin blog.csdn.net/weitao_666/article/details/133069600