With androidx.appcompat library FirebaseRecyclerAdapter not working

北慕城南 提交于 2020-01-06 01:54:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!