Can't resolve android.support.design. after migration to AndroidX

AndroidTextviewAndroid Support-LibraryAndroidxAndroid Snackbar

Android Problem Overview


I am trying to get the TextView of the Snackbar with this code snippet:

snackbarView.findViewById<TextView>(android.support.design.R.id.snackbar_text)  

but Android Studio does not resolve the design library.

How can I get this code to work?

Android Solutions


Solution 1 - Android

Solved with this solution: snackbarView.findViewById<TextView>(com.google.android.material.R.id.snackbar_text)

Solution 2 - Android

Thanks for the great answer by @dudi, in general in migration to androidX you can replace

android.support.design.R

with

com.google.android.material.R

I have written a brief step-by-step article on AndroidX migration here, if someone is interested to know more.

Solution 3 - Android

Changing this :

android.support.design.R

with

com.google.android.material.R

solves the problem . After Migration to AndroidX we are working with different library.

Solution 4 - Android

You've migrated to AndroidX, which means the library is different now.

(android.support.design.R.id.snackbar_text) to (com.google.android.material.R.id.snackbar_text)

Solution 5 - Android

As android.support.design.R is no more supported after androidx migration, So you need to replace it

with

com.google.android.material.R

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondudiView Question on Stackoverflow
Solution 1 - AndroiddudiView Answer on Stackoverflow
Solution 2 - AndroidAli NemView Answer on Stackoverflow
Solution 3 - AndroidsRawatView Answer on Stackoverflow
Solution 4 - Androiduser8730407View Answer on Stackoverflow
Solution 5 - AndroidAli NawazView Answer on Stackoverflow