在我的build.gradle
defaultConfig {
minSdkVersion 18
targetSdkVersion 28
versionCode 6
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('com.crashlytics.sdk.android:crashlytics:2.7.0@aar') { transitive = true; }
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0-alpha02'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha02'
implementation 'com.android.support:design:28.0.0'
implementation 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.yuyh.json:jsonviewer:1.0.6'
在我的布局xml中:
<?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">
<android.support.design.button.MaterialButton
android:id="@+id/viewJsonButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:onClick="@{() -> handler.onClickViewJson(item)}"
android:text="@string/view_json"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
但是当我尝试启动我的Android应用程序时,出现错误消息:
> Task :app:compileDebugKotlin
> Task :app:dataBindingExportFeaturePackageIdsDebug UP-TO-DATE
> Task :app:javaPreCompileDebug
> Task :app:compileDebugJavaWithJavac
Gradle may disable incremental compilation as the following annotation processors are not incremental: databinding-compiler-3.3.2.jar (androidx.databinding:databinding-compiler:3.3.2).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
D:\dev\myproject\android\TM\app\build\generated\data_binding_base_class_source_out\debug\dataBindingGenBaseClassesDebug\out\myproject\android\databinding\TraderListItemBinding.java:3: error: package android.support.design.button does not exist
import android.support.design.button.MaterialButton;
^
答案 0 :(得分:0)
您没有添加“材料按钮”的依赖性。