Why is custom Splash.png throwing a XML extension error

Viewed 101

I replaced the default splash.png images in the res/drawable folders with custom images which were named 'splash.png'.

However the build fails with the exception:

The file name must end with xml

This is thrown for the splash.png file in res/drawable-port-xhdpi.

The original file in /drawable-port-xhdpi had same name and extension, splash.png, as the current imported file, so I don't know what the issue is here.

This is the project folder view : enter image description here

Any input appreciated.

1 Answers

This error is due to the way android-studio handles rescources. If you want to include the picture in your app, you would have to add it to the drawable folder and android would automatically generate the correct alternate version of it, in the other drawable folders like your drawable-port-xhdpi. If you just go to drawable and add your image there (and if the file type is supported, sometimes png can be in some wierd color setting), then you will be able to add that to your app.

Also, it can be that the project you are trying to build needs to have an .xml as a splash image. Then you would have to get a vector graphic .svg of your image and add a Image Rescource via New>Vector Asset in the Project Window. Then your problem should be fine.

EDIT:

If you want to create an xml, just go to New>VectorAsset .Then your .svg file will be converted to .xml. If that doesnt work. Try getting back the old state with all the old splash images and without the error. Then try to find all old Splash images and replace them one by one with the excact same name.

Related