无法删除生成的DataBinding代码 [英] Can not remove generated DataBinding code

查看:71
本文介绍了无法删除生成的DataBinding代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I used DataBinding in one of my classes CardRecicleViewAdapterTech.class , but I imported a library which does not support DataBinding and I switched to butter knifefor that class. The problem is that when I run the project, Android Studio always generates a class binding related with CardRecicleViewAdapterTech.class and this causes a crash. The generated class is:

CardViewTechBinding.java

CardViewTechBinding.java

我已经删除了Android Studio数据绑定文件夹中的java文件,但是即使我不再在xmlclass中使用databinding时,该文件也会一次又一次地生成.

I have deleted that java file in Android Studio databinding folder, but its generated again and again even when I do not use databinding anymore in my xml or my class.

这是我不使用dataBinding的布局

This is my layout where I do not using dataBinding

card_view_tech.xml

card_view_tech.xml

即使在我不使用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>

我尝试重新启动PC和Invalidate缓存并重新启动Android Studio,但未成功.请帮忙.

I tried to restart my Pc and Invalidate cache and restart Android Studio but without success. Please help.

推荐答案

按此顺序:

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

这篇关于无法删除生成的DataBinding代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆