什么导致这个exceptionjava.lang.RuntimeException:java.lang.NoSuchMethodException:<init>

我的firebase项目出现问题 我遵循firebase GitHub文档上的步骤,但是我得到了这个exception

 java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View] 

这是一个不是内部类的ViewHolder类。

 public class ProductViewHolder extends RecyclerView.ViewHolder{ public View mView; public ImageView img; public TextView title; public TextView price; public RatingBar stars; ProductViewHolder(View itemView) { super(itemView); mView = itemView; img = (ImageView) itemView.findViewById(R.id.productImg); title = (TextView) itemView.findViewById(R.id.txtTitle); price = (TextView) itemView.findViewById(R.id.txtPrice); stars = (RatingBar) itemView.findViewById(R.id.ratingBar); } } 

这是与Firebase相关的代码

 @Override protected void onStart() { super.onStart(); // Recycler adapter FirebaseRecyclerAdapter<Product, ProductViewHolder> adapter = new FirebaseRecyclerAdapter<Product, ProductViewHolder>( Product.class, R.layout.product_list_item, ProductViewHolder.class, firebaseRef.child("product")) { @Override protected void populateViewHolder(ProductViewHolder productViewHolder, Product product, int i) { Picasso.with(ShopsApp.getLyShopsAppContext()) .load(product.getImgUrl()) .placeholder(R.drawable.none) .into(productViewHolder.img); productViewHolder.title.setText(product.getTitle()); productViewHolder.price.setText(product.getPrice()); productViewHolder.stars.setRating(4.0f); } }; recyclerView1.setAdapter(adapter); 

我正在使用viewHolder填充数据模型,而viewHolder类不是我的活动的内部类

注意:包含recyclerView的活动启动时发生exception。

Solutions Collecting From Web of "什么导致这个exceptionjava.lang.RuntimeException:java.lang.NoSuchMethodException:<init>"