Reputation: 782
I'm trying to migrate to androidx and i'm facing the following issue:
Databinding generates classes that includes android.support..
instead of androidx..
.
Does anyone have an ideea about how to replace android.support..
with androidx..
?
I'm using Android Studio 3.2, build gradle version is : 3.2.0.
Here is an example of bad generated imports:
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Switch;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.Bindable;
import androidx.databinding.DataBindingComponent;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
Upvotes: 1
Views: 1284
Reputation: 782
The problem was that binding generates classes based on bad .xml files.
Inside of .xml files were android.support.something
instead of androidx.something
.
This happened due to "migrate to androidx" feature which didn't replaced android.support.something
with the new include (androidx.something
) in the .xml files.
So to fix this you have to replace them manually.
Upvotes: 4
Reputation: 11
In my case, all XMLs appeared to be in a good state. However, Android Studio had invalid generated classes in its cache. Invalidate Caches/Restart did the trick.
Android Studio
Version: 3.5
Build #AI-191.8026.42.35.5791312, built on August 8, 2019
JRE: 1.8.0_202-release-1483-b49-5587405 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Upvotes: 1