Cannot Find Symbol Databindingcomponent on Android Studio 3.2 Canary 16 Kotlin Project

Cannot find symbol DataBindingComponent on Android Studio 3.2 Canary 16 Kotlin project

Databinding libraries are being refactored as a part of androidx refactoring.

I found the databinding annotation processor dependency link from google's maven repository here.

I've constructed the actual gradle dependency from there.

kapt "androidx.databinding:databinding-compiler:3.2.0-alpha16"

Update
As of Android studio 3.2.0-beta01, databinding no longer needs its annotation processor dependency to be declared in the gradle file, since databinding is capable of resolving its dependency.

Cannot find symbol DataBindingComponent on Android Studio 3.2 Canary 16 Kotlin project

Databinding libraries are being refactored as a part of androidx refactoring.

I found the databinding annotation processor dependency link from google's maven repository here.

I've constructed the actual gradle dependency from there.

kapt "androidx.databinding:databinding-compiler:3.2.0-alpha16"

Update
As of Android studio 3.2.0-beta01, databinding no longer needs its annotation processor dependency to be declared in the gradle file, since databinding is capable of resolving its dependency.

Android - Kotlin - cannot find symbol DataBindingComponent

Try Invalidate Caches/Restart.. in Android Studio.

Select and click Files->Invalidate Caches/Restart.. .

Sample Image

This will regenerate the required ones.

error: cannot find symbol class DataBindingComponent

This answer helped me in a similar case: https://stackoverflow.com/a/52550118/8655667

  1. Add lines
    android.enableExperimentalFeatureDatabinding=true and android.databinding.enableV2=false to gradle.properties
  2. Sync project
  3. Build -> Clean Project
  4. Build -> Rebuild Project

After rebuild it should give you the actual compilation failure reason.

Cannot find symbol DataBindingComponent after AndroidX migration

SOLUTION - increase logged erros

In the past, following was enough in the broject's build.gradle file:

gradle.projectsEvaluated {
tasks.withType(JavaCompile.class) {
options.compilerArgs << "-Xmaxerrs" << "10000"
}
}

With kotlin, following will help:

afterEvaluate {
if (project.plugins.hasPlugin("kotlin-kapt")) {
kapt {
javacOptions {
option("-Xmaxerrs", 10000)
}
}
}
}

REAL ISSUE

In my case I converted a class from java to kotlin with some fields like following:

@Arg
Integer someValue;

The converter created following:

@Arg
internal var someValue: Int? = null

The problem:

internal does not work with the annotation, so it failed, but the log only showed the data binding errors...

Example project build.gradle

https://gist.github.com/MFlisar/eca8ae6c2e6a619913ab05d503a4368f



Related Topics



Leave a reply



Submit