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

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

尽管我没有选择 photothumb.db 作为可绘制对象,但我收到一条错误消息,提示 photothumb.db 应以 .xml 或 .png

结尾

我的profilesmaller图像的类型是png

下面是我的代码

<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>

下面是我的 Gradle 控制台消息

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

Android 仅接受 .png、.jpg、.gif 和 .xml 文件作为可绘制资源。如果您有文件 .db 文件,则将该文件放在资产文件夹中。

将 photothumb.db 文件从 drawable 删除到 asset 目录。如果资产目录不存在,请右键单击 main > New > directory > assets 然后 create.Place 你的数据库文件在那里,你很高兴。

只需将您的图像文件扩展名(如 ico 等)更改为 png。 它会起作用。

我将 .png 图标转换为 .webp 格式后遇到了类似的问题。该文件是在 xxhdpi 文件夹中创建的,未使用。我不记得在我的应用程序的任何 xml 和 java 文件中创建或使用 photothumbs.db。只需删除 photothumbs.db 文件即可清除错误。为安全起见,在删除文件之前创建文件的备份副本。