【问题标题】:How to fix error No signature of method: build_9rfemhg4a5yc2kwb7aemx3270.android() is applicable for argument type如何修复错误没有方法签名:build_9rfemhg4a5yc2kwb7aemx3270.android() 适用于参数类型
【发布时间】:2021-07-31 11:44:24
【问题描述】:

我正在尝试将数据绑定添加到我的应用程序。 但是我启用数据绑定后得到的错误是: 没有方法签名:build_9rfemhg4a5yc2kwb7aemx3270.android() 适用于参数类型:(build_9rfemhg4a5yc2kwb7aemx3270$_run_closure1) 值:[build_9rfemhg4a5yc2kwb7aemx3270$_run_closure1@6e3b0699]

导致错误的部分是:

databinding {
   enabled = true
}

删除这部分会导致 gradle 正确构建。但是这样我就不能添加数据绑定了。

构建等级是:

plugins {
   id 'com.android.application'
   id 'kotlin-android'
}

android {
   compileSdkVersion 30
   buildToolsVersion "30.0.2"

   defaultConfig {
       applicationId "com.example.aboutme"
       minSdkVersion 19
       targetSdkVersion 30
       versionCode 1
       versionName "1.0"

       testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
   }

   buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-      rules.pro'
       }
   }
   databinding {
      enabled = true
   }
   compileOptions {
       sourceCompatibility JavaVersion.VERSION_1_8
       targetCompatibility JavaVersion.VERSION_1_8
   }
   kotlinOptions {
       jvmTarget = '1.8'
   }
}

dependencies {

   implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
   implementation 'androidx.core:core-ktx:1.3.2'
   implementation 'androidx.appcompat:appcompat:1.2.0'
   implementation 'com.google.android.material:material:1.1.0'
   implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
   testImplementation 'junit:junit:4.+'
   androidTestImplementation 'androidx.test.ext:junit:1.1.2'
   androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

【问题讨论】:

    标签: android android-studio gradle data-binding


    【解决方案1】:

    找到答案。 data'b'inding 不是 data'b'inding

    dataBinding {
      enabled = true
    }
    

    【讨论】:

      猜你喜欢
      • 2021-04-03
      • 1970-01-01
      • 1970-01-01
      • 2021-11-02
      • 1970-01-01
      • 1970-01-01
      • 2022-01-14
      • 2017-07-05
      • 1970-01-01
      相关资源
      最近更新 更多