Error inflating class android.support.design.widget.CoordinatorLayout and ClassNotFoundException: android.support.design.R$styleable

I got this error while Migrating to AndroidX

To resolve I did:

  1. as suggested by @Mikeumus – and added this to the module’s build.gradle dependencies:

    implementation ‘androidx.coordinatorlayout:coordinatorlayout:latest.version.here’

  2. check in the Layout XML file (the layout that you’re trying to launch with setContentView

if the Layout contains:
<android.support.design.widget.CoordinatorLayout

replace that with : <androidx.coordinatorlayout.widget.CoordinatorLayout

  1. in the same layout file – replace the closing tag

</android.support.design.widget.CoordinatorLayout>

with

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Leave a Comment