我收到错误消息
任务:app:compileDebugJavaWithJavac FAILED执行失败
从命令行构建android应用程序时
任务:app:compileDebugJavaWithJavac FAILED失败 /home/chetan/project/newGradle/app/build/generated/source/dataBinding/baseClasses/debug/com/demo/gradledemo/databinding/ActivityMainBinding.java:4:错误:找不到符号 导入android.databinding.DataBindingComponent; ^ 符号:类DataBindingComponent 位置:包android.databinding /home/chetan/project/newGradle/app/build/generated/source/dataBinding/baseClasses/debug/com/demo/gradledemo/databinding/ActivityMainBinding.java:18:错误:找不到符号
请让我知道如何解决此问题以从命令行构建android应用程序
app.gradle
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.demo.gradledemo"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug{
debuggable true
}
}
dataBinding {
enabled = true
}
}
activity_main.xml
<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>
<variable
name="datasource"
type="com.demo.gradledemo.ApplicationData"/>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{datasource.message}"/>
</LinearLayout>
</layout>