Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio cannot resolve symbols after cleaning gradle cache

I deleted all the existing artifacts (artifacts and metadata) Gradle has downloaded using:

rm -rf $HOME/.gradle/caches/

My issue is that now Android Studio cannot resolve any symbols from my dependencies. Eg. RecyclerView shows up as red and I cannot view it's source.

Things I have tried unsuccessfully:

  • Invalidate caches and restart
  • restart Android Studio
  • rebuild project
  • Refresh All Gradle Projects.

I was able to fix the issue by creating a copy of the project, but this is not an acceptable solution. I use the command to clear the cache several times a day and cannot be constantly creating copies.

like image 694
clever_trevor Avatar asked Jan 24 '26 10:01

clever_trevor


1 Answers

  1. Start Android Studio
  2. Switch the file view from "Android" to "Project" view
  3. Delete .idea
  4. Delete .gradle
  5. Delete all *.iml files
  6. Files -> "Invalidate Caches / Restart"
  7. "Invalidate and Restart"
like image 183
Sven Nähler Avatar answered Jan 27 '26 01:01

Sven Nähler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!