简体   繁体   中英

Databinding Android Studio Gradle 3.0.1

Since updating my gradle from 2.2.3 to 3.0.1 databanding has been generating the BR class in the wrong place resulting in cannot find symbol class BR

public abstract class BaseBindingFragment<T, K extends ViewDataBinding> extends BaseFragment<T> {

protected K mBinding;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    mBinding = DataBindingUtil.inflate(inflater, getLayoutResourceId(), container, false);
    mFragmentRootView = mBinding.getRoot();

    // Setup references to views within this fragment
    ButterKnife.bind(this, mFragmentRootView);
    initWidgets(mFragmentRootView);

    return mFragmentRootView;
  }
}

<data>
    <variable
        name="handler"
       type="com.mypackage.fragments.EditBillPaymentsFragment" />

    <variable
        name="billpayment"
        type="com.mypackage.database.models.Bills" />

</data>

            <EditText
                android:id="@+id/et_account_number"
                style="@style/editBill"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
                android:enabled="false"
                android:inputType="textPersonName"
                android:text="@={billpayment.payee.accountNumber}" />

BR file is generated at

com.yourpackage.BR;

So if you have wrong import then change it.

import com.yourpackage.BR;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM