NoSuchMethodException while using FirebaseRecyclerAdapter
See original GitHub issueI am using this library to show data in RecyclerView
using FirebaseRecyclerAdapter
. But app is crashing with the NoSuchMethodException
.
My code is:
mAdapter = new FirebaseRecyclerAdapter<TaskModel, TaskViewHolder>(TaskModel.class, R.layout.task_list_item, TaskViewHolder.class, firebase) {
@Override
protected void populateViewHolder(TaskViewHolder viewHolder, TaskModel model, int position) {
Log.i("HOME", "populateViewHolder called");
}
};
mRecyclerView.setAdapter(mAdapter);
View Helper class:
class TaskViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private TextView mTimeTv;
private TextView mTimeAmPm;
private TextView mTaskTitleTv;
private void findViews(View v) {
mTimeTv = (TextView) v.findViewById(R.id.time_tv);
mTimeAmPm = (TextView) v.findViewById(R.id.time_am_pm);
mTaskTitleTv = (TextView) v.findViewById(R.id.task_title_tv);
}
public TaskViewHolder(View itemView) {
super(itemView);
findViews(itemView);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
}
}
Please correct me if i am doing something wrong.
java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]
at com.firebase.ui.FirebaseRecyclerAdapter.onCreateViewHolder(FirebaseRecyclerAdapter.java:168)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5228)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:584)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1037)
at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:747)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:761)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1983)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:17
Issue Analytics
- State:
- Created 8 years ago
- Comments:42 (7 by maintainers)
Top Results From Across the Web
NoSuchMethodException while using FirebaseUI ...
I am trying to display the following JSON structure in a recyclerView using FirebaseUI and its recyclerAdapter.
Read more >com.firebase.ui.database.FirebaseRecyclerAdapter Maven ...
See the README * for an in-depth tutorial on how to set up the FirebaseRecyclerAdapter. * * @param The Java class that maps...
Read more >[Solved]-Recycler view is not displaying data from firebase using an ...
i want to favorite images from recycler view using Sql databse problem is that when i click on favorite button the table is...
Read more >FirebaseRecyclerAdapter.java example - Javatips.net
This class describes the usage of FirebaseRecyclerAdapter.java. ... <p> * To use this class in your app, subclass it passing in all required...
Read more >java lang nosuchmethodeexception, 线程main 中的异常'' java ...
NoSuchMethodException : onClick in list view on android , ... 我正在使用这个库使用FirebaseRecyclerAdapter 在RecyclerView 中显示数据。
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There are two likely causes for this:
TaskViewHolder
class ispublic
TaskViewHolder
is an inner class of e.g. your activity, make sure it’sstatic
So likely
pro-guard still caused crash… adding
@Keep
to the ViewHolder class solved for me…