Android 工作室 |无法解析现有的可绘制对象
Android Studio | cannot resolve existing drawable
我在编译 gradle 项目时遇到错误
Error:(128, 35) error: cannot find symbol variable ic_contact_picture
但这样的资源肯定是可用的,Android Studio 甚至在左边框中向我展示该资源的图片
我按照建议尝试清理、构建、重建、重启或同步 Studio/project,即 here,但都没有成功。
我做错了什么?
您正在使用 Android 系统中的 R
class,即 android.R
。如果 drawable ic_contact_picture
是你自己的图片,那么你想使用 R.drawable.ic_contact_picture
代替,没有 android.
前缀。
如果您打算使用 Android 系统可绘制对象,则必须将特定可绘制对象复制到您的应用程序,因为 ic_contact_picture
不是由 SDK 制作的 public。
我在编译 gradle 项目时遇到错误
Error:(128, 35) error: cannot find symbol variable ic_contact_picture
但这样的资源肯定是可用的,Android Studio 甚至在左边框中向我展示该资源的图片
我按照建议尝试清理、构建、重建、重启或同步 Studio/project,即 here,但都没有成功。
我做错了什么?
您正在使用 Android 系统中的 R
class,即 android.R
。如果 drawable ic_contact_picture
是你自己的图片,那么你想使用 R.drawable.ic_contact_picture
代替,没有 android.
前缀。
如果您打算使用 Android 系统可绘制对象,则必须将特定可绘制对象复制到您的应用程序,因为 ic_contact_picture
不是由 SDK 制作的 public。