title: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/material/bottomnavigation/BottomNavigationView$SavedState;
body: <blockquote>
    <p>java.lang.NoClassDefFoundError: Failed resolution of:
    Lcom/google/android/material/bottomnavigation/BottomNavigationView$SavedState;</p>
  </blockquote>
  
  <p>Issue while open an activity from one of the bottomNavigationView Fragments.</p>
  
  <p><strong>My HomeFragment</strong></p>
  
  <pre><code>override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
      val view = inflater.inflate(R.layout.fragment_home, container, false)
      view.buttonFeed.setOnClickListener {
          startActivity(Intent(getActivity(), FeedActivity::class.java))
      }
      return view
  }
  </code></pre>
  
  <p><strong>My TestActivity</strong></p>
  
  <pre><code>override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_feeds)
  }
  </code></pre>
  
  <p><strong>My BottomNavigationView code in my DashboardActivity</strong>     </p>
  
  <pre><code>override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_dashboard)
      try {
          bnView.setOnNavigationItemSelectedListener(BottomNavigationView.OnNavigationItemSelectedListener
          { menuItem -&gt;
              when (menuItem.itemId) {
                  R.id.nav_home -&gt; {
                      loadFragment(HomeFragment())
                      return@OnNavigationItemSelectedListener true
                  }
                  R.id.nav_notification -&gt; {
                      loadFragment(NotificationFragment())
                      return@OnNavigationItemSelectedListener true
                  }
                  R.id.nav_search -&gt; {
                      loadFragment(SearchFragment())
                      return@OnNavigationItemSelectedListener true
                  }
                  R.id.nav_account -&gt; {
                      loadFragment(AccountFragment())
                      return@OnNavigationItemSelectedListener true
                  }
              }
              false
          })
      } catch (e: Exception) {
          e.printStackTrace()
      }
      loadFragment(HomeFragment())
  }
  </code></pre>
  
  <p>And my error log:</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.foodshots.app, PID: 19568
  java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/material/bottomnavigation/BottomNavigationView$SavedState;
      at com.google.android.material.bottomnavigation.BottomNavigationView.onSaveInstanceState(BottomNavigationView.java:553)
      at android.view.View.dispatchSaveInstanceState(View.java:15872)
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3335)
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341)
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341)
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341)
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341)
      at android.view.View.saveHierarchyState(View.java:15855)
      at com.android.internal.policy.PhoneWindow.saveHierarchyState(PhoneWindow.java:2101)
      at android.app.Activity.onSaveInstanceState(Activity.java:1493)
      at androidx.core.app.ComponentActivity.onSaveInstanceState(ComponentActivity.java:83)
      at androidx.fragment.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:589)
      at androidx.appcompat.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:510)
      at android.app.Activity.performSaveInstanceState(Activity.java:1423)
      at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1322)
      at android.app.ActivityThread.callCallActivityOnSaveInstanceState(ActivityThread.java:4720)
      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3993)
      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4058)
      at android.app.ActivityThread.-wrap25(ActivityThread.java)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1591)
      at android.os.Handler.dispatchMessage(Handler.java:110)
      at android.os.Looper.loop(Looper.java:203)
      at android.app.ActivityThread.main(ActivityThread.java:6339)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)
   Caused by: java.lang.ClassNotFoundException: com.google.android.material.bottomnavigation.BottomNavigationView$SavedState
      at java.lang.VMClassLoader.findLoadedClass(Native Method)
      at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      at com.google.android.material.bottomnavigation.BottomNavigationView.onSaveInstanceState(BottomNavigationView.java:553) 
      at android.view.View.dispatchSaveInstanceState(View.java:15872) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3335) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.View.saveHierarchyState(View.java:15855) 
      at com.android.internal.policy.PhoneWindow.saveHierarchyState(PhoneWindow.java:2101) 
      at android.app.Activity.onSaveInstanceState(Activity.java:1493) 
      at androidx.core.app.ComponentActivity.onSaveInstanceState(ComponentActivity.java:83) 
      at androidx.fragment.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:589) 
      at androidx.appcompat.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:510) 
      at android.app.Activity.performSaveInstanceState(Activity.java:1423) 
      at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1322) 
      at android.app.ActivityThread.callCallActivityOnSaveInstanceState(ActivityThread.java:4720) 
      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3993) 
      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4058) 
      at android.app.ActivityThread.-wrap25(ActivityThread.java) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1591) 
      at android.os.Handler.dispatchMessage(Handler.java:110) 
      at android.os.Looper.loop(Looper.java:203) 
      at android.app.ActivityThread.main(ActivityThread.java:6339) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945) 
   Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/customview/view/AbsSavedState;
      at com.google.android.material.bottomnavigation.BottomNavigationView.onSaveInstanceState(BottomNavigationView.java:553) 
      at android.view.View.dispatchSaveInstanceState(View.java:15872) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3335) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.View.saveHierarchyState(View.java:15855) 
      at com.android.internal.policy.PhoneWindow.saveHierarchyState(PhoneWindow.java:2101) 
      at android.app.Activity.onSaveInstanceState(Activity.java:1493) 
      at androidx.core.app.ComponentActivity.onSaveInstanceState(ComponentActivity.java:83) 
      at androidx.fragment.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:589) 
      at androidx.appcompat.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:510) 
      at android.app.Activity.performSaveInstanceState(Activity.java:1423) 
      at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1322) 
      at android.app.ActivityThread.callCallActivityOnSaveInstanceState(ActivityThread.java:4720) 
      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3993) 
      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4058) 
      at android.app.ActivityThread.-wrap25(ActivityThread.java) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1591) 
      at android.os.Handler.dispatchMessage(Handler.java:110) 
      at android.os.Looper.loop(Looper.java:203) 
      at android.app.ActivityThread.main(ActivityThread.java:6339) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945) 
   Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.customview.view.AbsSavedState" on path: DexPathList[[zip file "/data/app/com.foodshots.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.foodshots.app-1/lib/arm, /system/lib, /vendor/lib]]
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      at com.google.android.material.bottomnavigation.BottomNavigationView.onSaveInstanceState(BottomNavigationView.java:553) 
      at android.view.View.dispatchSaveInstanceState(View.java:15872) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3335) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:3341) 
      at android.view.View.saveHierarchyState(View.java:15855) 
      at com.android.internal.policy.PhoneWindow.saveHierarchyState(PhoneWindow.java:2101) 
      at android.app.Activity.onSaveInstanceState(Activity.java:1493) 
      at androidx.core.app.ComponentActivity.onSaveInstanceState(ComponentActivity.java:83) 
      at androidx.fragment.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:589) 
      at androidx.appcompat.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:510) 
      at android.app.Activity.performSaveInstanceState(Activity.java:1423) 
      at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1322) 
      at android.app.ActivityThread.callCallActivityOnSaveInstanceState(ActivityThread.java:4720) 
      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3993) 
      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4058) 
      at android.app.ActivityThread.-wrap25(ActivityThread.java) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1591) 
      at android.os.Handler.dispatchMessage(Handler.java:110) 
      at android.os.Looper.loop(Looper.java:203) 
      at android.app.ActivityThread.main(ActivityThread.java:6339) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945) 
  </code></pre>