Video 70 - Error: Java.lang.NoClassDefFoundError
Hello everyone! I get this error
FATAL EXCEPTION: main Process: com.mustacheproject.bucketdrops, PID: 24967 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mustacheproject/bucketdrops/extras/MUtil; at com.mustacheproject.bucketdrops.widget.BucketRecyclerView.toogleViews(BucketRecyclerView.java:69) at com.mustacheproject.bucketdrops.widget.BucketRecyclerView.access$000(BucketRecyclerView.java:19) at com.mustacheproject.bucketdrops.widget.BucketRecyclerView$1.onChanged(BucketRecyclerView.java:26) at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:9242) at android.support.v7.widget.RecyclerView$Adapter.notifyDataSetChanged(RecyclerView.java:5493) at com.mustacheproject.bucketdrops.adapter.AdapterDrops.update(AdapterDrops.java:34) at com.mustacheproject.bucketdrops.ActivityMain$2.onChange(ActivityMain.java:52) at io.realm.RealmResults.notifyChangeListeners(RealmResults.java:1014) at io.realm.HandlerController.completedAsyncRealmResults(HandlerController.java:476) at io.realm.HandlerController.handleMessage(HandlerController.java:123) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mustacheproject.bucketdrops.extras.MUtil" o
The class MUtil is just the Util class create in the tutorial, the first string reported in the error ' at com.mustacheproject.bucketdrops.widget.BucketRecyclerView.toogleViews(BucketRecyclerView.java:69)'
is MUtil.hideViews(mEmptyViews);
in the break `}else{
//hide the emptyViews
MUtil.hideViews(mEmptyViews);
//set the recycle visible
setVisibility(View.VISIBLE);
//show the non empty views
MUtil.showViews(mNonEmptyViews);
}`
I sincerely don't understand what is the problem, searching on internet I found some issue related to this error regarding the libraries for different version, but I could't go further than this!
Thank you.
Eugenio
No classdef found error simply means you dont have the class, looks like you dont have this one MUtil
I had this Error 'void android.view.View.setVisibility(int)' on a null object reference
public static void showViews(List<View> views) { for (View view : views) { view.setVisibility(View.VISIBLE); } }
due to this Line >> view.setVisibility(View.VISIBLE);
I fixed, in MainActivity By Casting mEmptyView = (View) findViewById(R.id.empty_drops); to 'View'