Youngjae
Youngjae

Reputation: 25050

Android Studio shows red exclamation at drawable attribute

In layout XML files, the red exclamation mark is displayed left of @drawable references. Almost all drawables have this mark:

enter image description here

The content of shape_detail_btn_border.xml is as below. It is a group of shapes and does not have any broken image resource:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
    <solid android:color="@android:color/white"/>
    <corners android:radius="5dp"/>
    <stroke android:width="1dp" android:color="@color/bapul_color_d5d5d5"/>
</shape>

I hover the mouse on the mark and nothing shows up. what does this mean?

Note that the Android Studio version is 1.4 (AI-141.2288178), currently the most recent version. And, there's no problem to build and run the app at all.

Upvotes: 35

Views: 9904

Answers (2)

Youngjae
Youngjae

Reputation: 25050

In short, it's not an error from the code. It tells that "Android Studio failed to display the thumbnail of the given drawable."

Thanks @Ramz for finding an answer at https://stackoverflow.com/a/33032200/361100. I'll leave this post because this question is more descriptive than the linked one.

Upvotes: 60

Jon
Jon

Reputation: 565

The red exclamation point also appears in Java source files where a drawable is referenced. It can be eliminated by adding an on-demand static import for R.drawable. For example:

import static com.mycompany.myapp.R.drawable.*;

Upvotes: 0

Related Questions