Cannot resolve symbol R


#1

So I was working through the book, currently building CriminalIntent, when I found that as soon as I added the RecyclerView dependency, my program suddenly loses the ability to resolve R. I’ve tried pretty much everything (Cleaning and rebuilding the program, making a small change to gradle and rebuilding, restarting AndroidStudio, and even going so far as to move all my files to a secure location and completely uninstall AndroidStudio and reinstall). I’m at a loss. What can I do to resolve this?


#2

Try to complety delete folder build


#3

Do I need to do anything after that? I.e. clean and rebuild, etc?


#4

Rebuild…
And Android Studio creates this folder again


#5

Tried that. When I do, I get these errors


#6

This problem happened to me during the Geoquiz for no apparent reason. I closed the project and Android Studio and it resolved itself.


#7

I already tried that, but to no avail


#8

Your problem caused by an incompatibility with the android support library version.
ALL support libraries MUST have the same version.
(Do not use 28.0.0-alpha)

So, check your build.gradle

For example, use 26.1.0:

  implementation 'com.android.support:appcompat-v7:26.1.0'
  implementation 'com.android.support:recyclerview-v7:26.1.0'

#9

I fixed the error in my recyclerview line, but I get this error for the appcomat line:

Thanks a ton, by the way.


#10

Please show full dependencies section in your build.gradle


#11

Absolutely! Sorry about that


#12

Hmm… All must be fine. I don’t see more problems. Try menu “Tools” - “Android” - “Sync Project with gradle files”


#13

No effect. If it helps, R can now apparently be resolved; the only issue is the one with implementation ‘com.android.support:appcompat-v7:26.0.0’

EDIT: changing both lines to use v7:26.1.0 seems to have worked