问题
When upgrading build tool version
and target SDK version
to API 28 we have to use new support libraries with androidx
prefix. I have replaced all libs with new libs here they are
// Libs for newer API 28
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'
Now FirebaseRecyclerAdapter from the import below, asking me to extend my ViewHolder class from android.support.v7
.
import com.firebase.ui.database.FirebaseRecyclerAdapter;
And has this suggestion
Type parameter 'com.domain_name.app_name.FriendsFragment.FindFriendsViewHolder' is not within its bound; should extend 'android.support.v7.widget.RecyclerView.ViewHolder'
I'm extending ViewHolder
from API 28 with the below import
androidx.recyclerview.widget.RecyclerView;
User Sam Stern on github suggested to add below two lines in gradle.properties
file
android.useAndroidX=true
android.enableJetifier=true
But with these lines, my adapter class do not recognize onCreateViewHolder
method and says "Method 'onCreateViewHolder(android.view.ViewGroup, int)' is never used".
Please let me know how to make it work with new libs from androidx
. I will be thankful for this.
来源:https://stackoverflow.com/questions/53295106/with-androidx-appcompat-library-firebaserecycleradapter-not-working