Question

I have a build fail due to the following error

[aapt] res/drawable-xhdpi/splash.png:0: error: Resource entry splash is already defined.

[aapt] res/drawable-xhdpi/splash.9.png:0: Originally defined here.

Any ideas? Thanks!

Was it helpful?

Solution 2

You cannot include something.png and something.9.png at the same time. Delete or rename one of them.

OTHER TIPS

This error could also happen, if you use cordova and renamed an existing image (in my case there was only splash.9.png present, but the same error occurred.

In this case you need to clean the project, using

./platforms/android/cordova/clean

All of the above answers where wrong for me :D The problem was, that ive had already compiled once with files named splash.png (actually: screen.png in my case).

After draw9patching and renaming them to .9.png (which you have to in order to make them work) I had to remove all files in ant-build to get rid of the error: the compiler seems to sort of correctly fail because he gets two different files with the same name by ignoring the different extension.

You have two files in resources splash.png and splash.9.png.You cannot include splash.png and splash.9.png at the same time.

Delete the file not being used and the compile you will be able to build successfully.

As you are using two image with same name, one is simple one and another is nine patch which cause error, delete one of which you are not using or you don't wanna use.

which is not in use then delete splash.png or /splash.9.png

rename the splash.png to something else. splash.9.png is valid if it is 9-patched. But you cannot keep both splash.png and splash.9.png.

Rename splash.9.png to splashnew.png .

Never use "." "_" etc other special characters for your resource images and files!

You can remove the dots and name it splash9.png

Ref:http://developer.android.com/tools/help/draw9patch.html

Note: A normal PNG file (.png) will be loaded with an empty one-pixel border added around the image, in which you can draw the stretchable patches and content area. A previously saved 9-patch file (.9.png) will be loaded as-is, with no drawing area added, because it already exists.

To me this was my solution First perform this action

cordova clean

And you can now do this

cordova build android
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top