'Cannot Resolve class TextView in xml file
I just changed my Laptop, downloaded Android Studio Arctic Fox and cloned the project on which I was already working on in my previous machine. I see that few of the tags are not imported and are in red in the xml layout. When I hover over it, it says "Cannot resolve class TextView". Similar issue with ImageView. What is wrong?
Solution 1:[1]
I also facing the same problem for 2 days, try lots of the way but didn't work. But a few minutes ago I just update my Glradle to the
classpath 'com.android.tools.build:gradle:7.0.1'
and boom it's solved my problem. You can try this :)
Solution 2:[2]
after clean the project sync the build gradle or cut and paste a one dependency and sync the gradle
Solution 3:[3]
This error but made a struggle 3 days; I solved it by upgrading gradle to the latest version on this day gradle: 7.0.3 at the classpath level (build.gradle (project))
Solution 4:[4]
I solved this error by set Gradle user home ? 1.File -?Project Structure -?SDK Location -?Gradle Setting -?Gradle user home ?select your local?
Solution 5:[5]
Most probably, you might have been using androidx libraries.
Try androidx.appcompat.widget.AppCompatTextView
instead of
<TextView
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sohag |
| Solution 2 | viranga LH |
| Solution 3 | Berthold Bawouke |
| Solution 4 | AndroidLearnDay |
| Solution 5 | Niraj Niroula |

