I'm learning android data binding. The problem I'm facing is that in case of errors related to data binding with my current setup I'm getting very general error messages which give no clue of what and where has happened exactly instead of very specific ones that were mentioned in some topics on data binding (for instance).
Consider following layout:
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<!--<import type="android.view.View"/>-->
<!--<import type="android.text.TextUtils"/>-->
<variable
name="movie"
type="us.kostenko.architecturecomponentstmdb.details.model.Movie" />
</data>
<TextView
<!-- ... -->
android:text="@{TextUtils.isEmpty(movie.release_date) ? @string/empty_date : movie.release_date}"/>
</layout>
Note that imports are commented out on purpose to trigger an error.
I expected to get something like Identifiers must have user defined types from the XML file. TextUtils is missing it
error. But the error I'm getting is very general one:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptDebugKotlin'.
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.GradleException: Compilation error. See log for more details
at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:16)
at org.jetbrains.kotlin.gradle.internal.KaptWithKotlincTask.compile(KaptWithKotlincTask.kt:79)
I suspect there's something wrong with my setup. I'm using Android studio 3.1.4.
Here's my build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
//...
dataBinding { enabled = true }
}
dependencies {
// ...
kapt "com.android.databinding:compiler:3.1.4"
}
And the project level one:
buildscript {
ext.kotlin_version = '1.2.70'
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Any ideas what I'm missing here?