anderZubi anderZubi - 7 days ago 6
Android Question

Failed to convert @drawable/ into a drawable

I have added an image to my Android project which I want to use in the UI. I have added the file my-image.png to the drawable directory (to all 4 drawable directories created with the project), and added the

ImageView
to the layout:

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentBottom="true"
android:layout_alignLeft="@+id/textView"
android:layout_marginBottom="63dp"
android:src="@drawable/my-image" />


The problem is that I get the following error:


Rendering Problems

Failed to convert @drawable/my-image into a drawable


This is the capture:

enter image description here

Additionaly, if I try to compile the project, I get the following error:


Gradle: Execution failed for task ':MyProject:processDebugResources'.


Why do I get these errors and how can I solve it? Am I missing something? I've just started Android development.

Answer
Gradle: Execution failed for task ':MyProject:processDebugResources'.

because you have naming convention error in Resources

file name: must contain only [a-z0-9_.]

Rename file name to my_image