prom85
prom85

Reputation: 17868

Cannot find symbol DataBindingComponent after AndroidX migration

After migrating my whole project to android x I can't get it to compile anymore.

I get 100 of following errors:

e: M:\tmp\EverywhereLauncher\app\generated\data_binding_base_class_source_out\devWithoutTestWithAccessibilityDebug\dataBindingGenBaseClassesDevWithoutTestWithAccessibilityDebug\out\com\my\app\databinding\ActivityMainBinding.java:52: error: cannot find symbol
      @Nullable ViewGroup root, boolean attachToRoot, @Nullable DataBindingComponent component) {
                                                                ^
  symbol:   class DataBindingComponent
  location: class ActivityMainBinding

I don't know where to continue.

I have two problems now.

What I tried:

Any ideas what I could do next?

Additional

Upvotes: 6

Views: 6211

Answers (2)

enyciaa
enyciaa

Reputation: 2122

I was also getting this bug after updating to androidx, tried everything suggested in a few stack overflow posts, finally updating to gradle plugin 3.3.0-beta03 worked

Upvotes: 1

prom85
prom85

Reputation: 17868

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

Upvotes: 5

Related Questions