Android error Duplicate Resources

That's because Android considers the following to be the same when you referenced the images in your layouts:

E:\Android\LED\app\src\main\res\drawable-hdpi\login_bg.png
E:\Android\LED\app\src\main\res\drawable-hdpi\login_bg.9.png

login_bg.9.png image tells Android that this image is a 9-patch image. Whereas, the other image, login_bg.png, is a normal image. But in terms of referencing the images, they are declared the same, as in the following examples.

Normal image:

<ImageView
    android:id="@+id/normalImage"
    android:background="@drawable/login_bg"/>

Nine-patch image:

<ImageView
    android:id="@+id/ninePatchImage"
    android:background="@drawable/login_bg"/>

Note: There is no difference in terms of referencing the images from your /res/drawables directory of your Android project.

See here for more info about nine-patch image, or the correct term for it is nine-patch drawable. For reference, nine-patch drawables must be declared as <name>.9.png, as in login_bg.9.png.


basically it will occur whenever the xml detects multiple files with same name, regardless of their extension type. e.g : mypicture.jpg can not be in same directory folder with mypicture.png

so does with your case, login_bg.9.png and login.png in the same directory folder is not allowed.

hopefully this may be useful. have a good day


Delete the image from drawable directory because you are using same name director within one folder which is not allowed.