我刚刚在Android Studio 3.2 Canary 16上创建了一个新项目,启用了Kotlin.然后我也启用了数据绑定,但是我收到一条错误,说它无法找到DataBindingComponent类.
这是我的项目gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.41'
ext.android_plugin_version = '3.2.0-alpha10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha16'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
我的模块gradle文件:
apply plugin: 'com.android.application'
apply plugin: …Run Code Online (Sandbox Code Playgroud) 今天早上我做了android studio从3.0.1到3.1.0 的更新.更新gradle到最新版本后,我仍然遇到有关数据绑定的构建错误.
我的gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Run Code Online (Sandbox Code Playgroud)
我的所有错误都如下所示:
/Users/mp/Documents/GitHub/projectx/app/build/generated/source/dataBinding/baseClasses/Staging/debug/me/projectx/asdasd/databinding/GridItemActivityTypeBinding.java:57: error: cannot find symbol
@Nullable DataBindingComponent component) {
^
symbol: class DataBindingComponent
location: class GridItemActivityTypeBinding
Run Code Online (Sandbox Code Playgroud)
有没有人知道为什么我的数据绑定不会在android studio 3.1更新后生成?提前致谢
编辑1:忘了说,我试过清理/重建/无效缓存和重启/删除构建文件夹.