"Couldn't resolve resource" in Android Studio's Preview
AndroidAndroid StudioAndroid Problem Overview
After adding new items in strings.xml
, quite often they don't start working immediately in Android Studio's Preview.
> Couldn't resolve resource @string/faq_customer_service
Preview looks like this:
I've obviously tried to re-build the project, and even run gradle clean assembleDebug
, but it doesn't seem to help. On emulator & real device the newly-added string resources do work.
Any trick to force Android Studio to reload the resources so that the correct texts show up in Preview?
Android Solutions
Solution 1 - Android
The only reliable way I've found so far is reloading the project / restarting Android Studio.
Quickest way to do that is File → Invalidate caches / Restart... → Just Restart.
Feel free to post better solutions!
Solution 2 - Android
you DO NOT need to close the entire project. It's just way too much for so little problem.
Just refresh the preview (click the "refresh" button)
provided from https://stackoverflow.com/a/34754707/3339597
Solution 3 - Android
Right click on project and Synchronize '...Project' worked for me.
Solution 4 - Android
There are three steps for solving this problem
-
Build -->Clean Project
-
Build -->Rebuild Project
-
Restart android studio
Solution 5 - Android
Couldn't resolve resource @string/faq_customer_service or Couldn't resolve resource @id/visible or Couldn't resolve resource @id/masked The solution is if you implement TextInputLayout the above problems may arise ... so Simply add those id or strings to xml files as their property.
Solution 6 - Android
File → Invalidate caches / Restart... → Just Restart ... didn't work for me
File → Invalidate caches / Restart... → Invalidate And Restart ... worked for me
Solution 7 - Android
Render Problem:
Couldn't resolve resource @string/hello_blank_fragment
Just refresh the Layout.
work for me..