相关疑难解决方法(0)

在Android Studio 3.2 Canary 16 Kotlin项目上找不到符号DataBindingComponent

我刚刚在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 kotlin android-databinding

82
推荐指数
12
解决办法
4万
查看次数

3.1.0更新后,Android Studio无法生成数据绑定

今天早上我做了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:忘了说,我试过清理/重建/无效缓存和重启/删除构建文件夹.

android android-studio android-studio-3.1

36
推荐指数
4
解决办法
3万
查看次数

:app:kaptDevDebugKotlin FAILED 构建异常:找不到符号 DataBindingComponent

我一直试图解决这个烦人的问题太久了,但没有任何进展。

我们的应用程序大部分类都是用 Kotlin 编写的,我们也使用了数据绑定:

apply plugin: "kotlin-kapt"  
apply plugin: 'kotlin-android'  
apply plugin: 'kotlin-android-extensions'
Run Code Online (Sandbox Code Playgroud)

在尝试运行 de 应用程序时,我们在构建对话框中看到多个异常如下(当我说多个时,我的意思是超过 50 个):

e: .../android/app/build/generated/source/dataBinding/baseClasses/dev/debug/com/company/app/databinding/IncludeFilterHeaderTabButtonBinding.java:21: error: cannot find symbol
  protected IncludeFilterHeaderTabButtonBinding(DataBindingComponent _bindingComponent, View _root,
                                                ^
  symbol:   class DataBindingComponent
  location: class IncludeFilterHeaderTabButtonBinding
Run Code Online (Sandbox Code Playgroud)

这个应用程序导入了一个完全用 Java 编写的自制 SDK,并且还使用了数据绑定。这样做有什么已知问题吗?

这是主应用程序的依赖项:

implementation 'com.android.support:support-core-utils:27.1.1'  
implementation 'com.android.support:support-annotations:27.1.1'  
implementation 'com.android.support.constraint:constraint-layout:1.1.2'  
implementation 'com.android.support:appcompat-v7:27.1.1'  
implementation 'com.android.support:design:27.1.1'  
implementation 'com.android.support:cardview-v7:27.1.1'  
implementation 'com.android.support:recyclerview-v7:27.1.1'  
implementation 'com.android.support:customtabs:27.1.1'  

implementation 'com.google.android.gms:play-services-vision:12.0.1'  
implementation 'com.google.android.gms:play-services-maps:12.0.1'  

implementation 'com.afollestad.material-dialogs:core:0.9.6.0'  
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'  

implementation 'com.github.bumptech.glide:glide:4.7.1'  
kapt 'com.github.bumptech.glide:compiler:4.7.1'  
implementation 'com.github.bumptech.glide:compiler:4.7.1'  
kapt "com.android.databinding:compiler:3.1.3"

implementation 'com.squareup.okhttp3:okhttp:3.9.0'  
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'  

implementation 'com.squareup.retrofit2:retrofit:2.3.0'  
implementation …
Run Code Online (Sandbox Code Playgroud)

data-binding android kotlin

5
推荐指数
1
解决办法
7644
查看次数