A. Liu A. Liu - 5 months ago 52
Android Question

Android drawable: Unknown resource type @drawable-nodpi

I created a new Android Resource Directory

drawable-nodpi
inside of res and placed my a png image inside, but when I try to reference it with the code below, it returns an error of

unknown resource type @drawable-nodpi
.

What am I doing wrong? I works fine when I place it into
@drawable
but the image was
too large to be uploaded into a texture
. I am using Android Studio 2.1.2


android:src="@drawable-nodpi/java"

Answer

You don't use @drawable-nodpi/java. It should be @drawable/java. Android will automatic select the source with device's configuration.