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..
.
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
- Add lines
android.enableExperimentalFeatureDatabinding=true
andandroid.databinding.enableV2=false
togradle.properties
- Sync project
- Build -> Clean Project
- 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
Update Text of Notification, Not Entire Notification
Android:How to Update the Selector(Statelistdrawable) Programmatically
Render Error in Android Studio 3.0 Layout Editor
How to Get the Selected Item from Listview
Display All Unicode Chars in Textview
Broadcastreceiver as Inner Class
How to Give Everyone Access to Firestore Database, But Only via App
How to Use Data-Binding with Fragment
How to Use Dimens.Xml in Android
Accessing Files from Genymotion Sd Card
Get the Progress Time of the Video Played Under Videoview
Is Google's Android Opengl Tutorial Teaching Incorrect Linear Algebra
Executing Multiple Asynctask's Parallely
How to Ping a Url in an Android Service
Best Way to Manage the Progressdialog from Asynctask
Java.Lang.Noclassdeffounderror: Com.Google.Android.Gms.R$Styleable in Android