[Android Studio] Unable to resolve android.support.v7.widget.RecyclerView
by Riley MacDonald, May 3, 2018

Suddenly my OSX installation of Android Studio (3.1.2) was unable to resolve RecyclerView and several other symbols. My application would build and deploy without any errors but the editor was full of errors. I took several approaches to try and resolve this issue including:

  • Clearing the local maven repository (rm -rf ~/.m2/repository/com).
  • Clearing the local gradle cache (rm -rf ~/.gradle/caches).
  • Clearing the Android Studio maven repository (rm -rf /Applications/Android Studio.app/Contents/gradle/m2repository/*).
  • Clearing the projects idea cache (rm -rf /path_to_project/.idea/caches).
  • Clearing the projects .gradle rm -rf /path_to_project/.gradle).
  • Cleaning the project (./gradlew cleanBuildCache && ./gradlew clean).
  • Invalidating and restarting Android Studio
  • Reinstalling the support libraries
  • Reinstalling Android Studio

The only solution I found for this issue was to quit Android Studio, completely remove the projects .idea/ directory and reimport the project. Apparently there’s a (potentially corrupted) reference in .idea/libraries that was causing this issue? Very frustrating.

Open the comment form

Leave a comment:

Comments will be reviewed before they are posted.

User Comments:

Be the first to leave a comment on this post!