无法删除生成的DataBinding代码

JoC*_*uTo 8 android android-studio android-databinding

DataBinding在我的一个类中使用过CardRecicleViewAdapterTech.class,但是我导入了一个不支持DataBinding的库,我切换到butter knife了那个类.问题是,当我运行项目时,Android Studio总是生成与之相关的类绑定CardRecicleViewAdapterTech.class ,这会导致崩溃.生成的类是:

CardViewTechBinding.java

我已经删除了Android Studio数据绑定文件夹中的那个java文件,但是即使我不再使用databindingxml或我的文件,它也会一次又一次地生成class.

这是我不使用dataBinding的布局

card_view_tech.xml

这样CardViewTechBinding.java 即使我不使用也会生成dataBinding

<?xml version="1.0" encoding="utf-8"?>

<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:ProgressWheel="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_tech"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:layout_gravity="center"
        android:layout_marginTop="@dimen/standard_margin"
        android:layout_marginLeft="@dimen/standard_margin"
        android:layout_marginRight="@dimen/standard_margin"
        card_view:cardCornerRadius="4dp"
        card_view:cardBackgroundColor="@color/primary_light">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:text="TextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/text_view_technologie_name" />

            <com.pro.soft.apppresentation.ProgressWheel
                android:id="@+id/pw_spinner"
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:layout_centerInParent="true"
                ProgressWheel:pwText="Authenticating..."
                ProgressWheel:pwTextColor="#222"
                ProgressWheel:pwTextSize="14sp"
                ProgressWheel:pwRimColor="#330097D6"
                ProgressWheel:pwBarLength="60dp"
                ProgressWheel:pwBarColor="#0097D6"
                ProgressWheel:pwBarWidth="5dp"
                ProgressWheel:pwRimWidth="2dp" />
        </LinearLayout>

    </android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)

我尝试重新启动我的Pc和Invalidate缓存并重新启动Android Studio但没有成功.请帮忙.

小智 12

按此顺序:

1.- Remove your file generated (build folder)
2.- Clean your project
3.- Invalidate cache and restart Android Studio
4.- Restart computer
Run Code Online (Sandbox Code Playgroud)

  • 没有重新启动计算机工作. (4认同)

Wyk*_*yko 6

我遇到了同样的问题,这是由<layout>XML中的根标记引起的。我没有意识到这些标签是数据绑定相关的,编译器在这方面也没有帮助你。