Char
Char

Reputation: 2133

Error: The file name must end with .xml or .png

Even though I didn't choose photothumb.db as a drawable, I get an error saying photothumb.db should end with .xml or .png

my profilesmaller image is of type png

Below are my codes

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/profilesmaller"
    tools:context="charlenebuena.guest.HomeFragment">
</FrameLayout>

Below is my Gradle Console Message

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> C:\Users\Charlene Marie\AndroidStudioProjects\Guest\app\src\main\res\drawable\photothumb.db: Error: The file name must end with .xml or .png

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.72 secs

Upvotes: 9

Views: 47775

Answers (6)

rabie jegham
rabie jegham

Reputation: 125

just check if there are weird directory names under in /app/src/main/res/

🦒 $ ls drawable mipmap-hdpi drawable-hdpi mipmap-mdpi drawable-ldpi mipmap-xhdpi drawable-mdpi mipmap-xxhdpi drawable-xhdpi mipmap-xxxhdpi drawable-xxhdpi raw drawable-xxxhdpi rawwhilemusic.mp3 winner.mp3 <- (after deleting this directory no error) layout values mipmap-anydpi-v26

Upvotes: 0

Peter
Peter

Reputation: 13505

This happened to me when somehow (I have no idea how) one of my asset files got ended up in

.../app/src/main/res/assets/model.tflite 

When it should have been at

.../app/src/main/assets/model.tflite

Moving it back fixed the problem.

Upvotes: 3

Arnulfo B. Bataller
Arnulfo B. Bataller

Reputation: 526

I had a similar problem after I converted .png icons to .webp format. The file was created in the xxhdpi folder and not used. I didn't remember creating or using photothumbs.db in any of my app's xml and java files. The error was cleared after simply deleting the photothumbs.db file. Create a backup copy of the file anyway for safety before deleting it.

Upvotes: 3

Akshansh Jain
Akshansh Jain

Reputation: 87

Just change your image file extension from something(like ico etc) to png. It will work.

Upvotes: -2

Nitesh
Nitesh

Reputation: 328

Remove photothumb.db file from drawable to asset directory. If asset directory is not there then right click on main > New > directory > assets and then create.Place your db file there and you are good to go.

Upvotes: 1

Dhanveer thakur
Dhanveer thakur

Reputation: 988

Android accepts only .png, .jpg, .gif and .xml files as drawable resources. If you have file .db file then put that file in assets folder.

Upvotes: 17

Related Questions