"Couldn't resolve resource" in Android Studio's Preview

AndroidAndroid Studio

Android 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:

enter image description here

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) refresh button arrow

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

  1. Build -->Clean Project

  2. Build -->Rebuild Project

  3. 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..

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJonikView Question on Stackoverflow
Solution 1 - AndroidJonikView Answer on Stackoverflow
Solution 2 - AndroidRe'emView Answer on Stackoverflow
Solution 3 - AndroidŞah-ı MerdanView Answer on Stackoverflow
Solution 4 - AndroidHarun ERGULView Answer on Stackoverflow
Solution 5 - Androidkeshav mainaliView Answer on Stackoverflow
Solution 6 - AndroidZainView Answer on Stackoverflow
Solution 7 - AndroidHeshanHHView Answer on Stackoverflow