“无法解析资源"在 Android Studio 的预览版中 [英] "Couldn't resolve resource" in Android Studio's Preview
问题描述
在 strings.xml
中添加新项目后,它们通常不会立即在 Android Studio 的预览版中开始工作.
After adding new items in strings.xml
, quite often they don't start working immediately in Android Studio's Preview.
无法解析资源@string/faq_customer_service
Couldn't resolve resource @string/faq_customer_service
预览如下:
我显然已经尝试重新构建项目,甚至运行 gradle clean assembleDebug
,但它似乎没有帮助.在模拟器上真机新添加的字符串资源确实有效.
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.
有什么技巧可以强制 Android Studio 重新加载资源,以便在预览中显示正确的文本?
Any trick to force Android Studio to reload the resources so that the correct texts show up in Preview?
推荐答案
目前我发现的唯一可靠方法是重新加载项目/重新启动 Android Studio.
The only reliable way I've found so far is reloading the project / restarting Android Studio.
最快的方法是文件 →使缓存无效/重新启动... →只需重新启动.
随时发布更好的解决方案!
Feel free to post better solutions!
这篇关于“无法解析资源"在 Android Studio 的预览版中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!