Cannot resolve DataBindingUtil

Hello

Having an issue using the DataBindingUtil class. Android Studio cannot resolve symbol DataBindingUtil.

package com.bignerdranch.android.beatbox;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bignerdranch.android.beatbox.databinding.FragmentBeatBoxBinding;

/**

  • Created by keeran on 2017/11/08.
    */

public class BeatBoxFragment extends Fragment {

public static BeatBoxFragment newInstance() {
    return new BeatBoxFragment();
}

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    FragmentBeatBoxBinding binding = DataBindingUtil
            .inflate(inflater, R.layout.fragment_beat_box, container, false);
   //DataBinddingUtil
    return super.onCreateView(inflater, container, savedInstanceState);
}

}

Even if i manually add the import statement:
import android.databinding.DataBindingUtil;
still cannot resolve symbol DataBindingUtil.

I tried restarting android studio twice with no luck.
Assistance will be much appreciated.

Thanks

Did you add dataBinding { enabled= true} in your gradle to below buildTypes {}?

Hi
Yes I did.
Seemed to be something to do with the build SDK version. I was on 26
revision 1.
Even after changing this it didn’t help.
I ended up reinstalling android studio and it worked.
Thanks

1 Like