C0D3LIC1OU5
C0D3LIC1OU5

Reputation: 8680

Android Studio 2.2 Databinding error

I've just updated Android Studio to 2.2, Gradle plugin to 2.2.0 and I am getting the following error in the project when initializing views using DataBinding. It says Type T has incompatible upper bounds. Android Studio offers no suggestions on how to fix this. Casting the binding to the exact class doesn't solve the issue.

getting this error

It still compiles and runs though, but project is full of red errors - one for each DataBinding initialization. Any ideas?

Upvotes: 2

Views: 1565

Answers (3)

Ryhan
Ryhan

Reputation: 1885

With Android Studio 2.2 - I had to do Maksim's solution + executing ./gradlew in the terminal to make the .gradle directory pull the 3.1 gradle version in order to make everything work.

Upvotes: 0

  1. open gradle-wrapper.properties
  2. update distributionUrl https://services.gradle.org/distributions/gradle-3.1-all.zip
  3. File->Invalidate Caches/Restart
  4. Invalidate and Restart

Upvotes: 6

qinmiao
qinmiao

Reputation: 5789

My project is working.

   private LoadImageByPicassoBinding mBinding;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        //mBinding = LoadImageByPicassoBinding.inflate(inflater, container, false);
        mBinding = DataBindingUtil.inflate(inflater, R.layout.load_image_by_picasso, container, false);
        return mBinding.getRoot();
    }

Upvotes: 0

Related Questions