Reputation: 1170
Happen on Android Studio Preview - Arctic Fox (2020.3.1) Beta 4.
I've tried literally everything from multiple questions on SO; Clean Build, Invalidate Caches and Restart, remove root project's .gradle
and .idea
, remove caches folder in .gradle
, even remove and download Android Studio again, you name it.
It's been almost a day and still can't figure it out, please help, this is killing my motivation :(
Upvotes: 6
Views: 3502
Reputation: 217
I had the same issue that Android studio can't recognize the xml elements
⛔ Problem
Cannot resolve class layout
Element layout must be declared
✅ Solution
Is the clear the cache of Android Studio
Upvotes: 1
Reputation: 307
In my case deleting ~/.gradle
and invalidating caches did the trick.
Upvotes: 0
Reputation: 71
I was facing the same problem with an old project written totally in Java. Adding the following dependency in the project gradle file solved the problem.
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
Upvotes: 5
Reputation: 1170
I've finally managed to solve this problem myself.
The steps are to remove the current project --> clone the project again from git --> Re-import project and rebuild.
Android Studio is funny sometimes.
Upvotes: 1
Reputation: 780
You can use this for imageView
<androidx.appcompat.widget.AppCompatImageView />
instead of
<ImageView />
and for textView use this
<androidx.appcompat.widget.AppCompatTextView />
instead of
<TextView />
Upvotes: 0