不再生成 Android BuildConfig

问题描述

我从 Kotlin Synthetics 转换为使用 Jetpack 视图绑定,之后就找不到 BuildConfig

我的模块的 build.gradle 文件有这个:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "com.mycompany.myapp"
        minSdkVersion 29
        targetSdkVersion 30
        versionCode 1
        versionName "0.6"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
   }

  buildFeatures {
    dataBinding true
    viewBinding true
 }

 buildTypes {
     release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
        buildConfigField("String","BUILD_TIME","\"0\"")
        resValue("string","build_time","0")
    }
    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),"0")
    }
 }

 compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
 }

 packagingOptions {
    exclude 'meta-inf/kotlinx-coroutines-core.kotlin_module'
 }
 
kotlinoptions {
    jvmTarget = '1.8'
}

}

我的 gradle 属性看起来像这样(运行最新的)

distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

我正在尝试进行干净的构建、使缓存无效等

有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)