Bakri Bitar
Bakri Bitar

Reputation: 1697

Android Studio - Failed to convert @drawable/ into a drawable

I am getting this error when I am trying to use an image in Layout file:

Couldn't resolve resource @drawable
Failed to convert @drawable/image into a drawable

Here is my layout file

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
    <ImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:src="@drawable/image"
        />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>

I tried restart IDE, clean-rebuild but nothing, and I read all threads related to it ( I think ). And yes my image name contains only [a-z0-9_.].

Upvotes: 2

Views: 5403

Answers (2)

Bakri Bitar
Bakri Bitar

Reputation: 1697

Well, I found a way to avoid this

RightClick on drawable folder then New => File insert its name (myImage) for example Then Select Image Files.

Then in drawable folder I replaced myImage file with the real image.

Upvotes: 1

3nomis
3nomis

Reputation: 1613

I had the same problem, I solved it by renaming my image into something like : my_image.

Upvotes: 3

Related Questions