Bakri Bitar Bakri Bitar -4 years ago 199
Android Question

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_.].

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download