虽然我没有选择photothumb.db作为drawable,但我得到一个错误,说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文件,则将该文件放在assets文件夹中。
将photothumb.db文件从drawable删除到asset目录。如果资产目录不在那里,那么右键单击main> New> directory> assets然后create.Place你的db文件,你很高兴。
将.png图标转换为.webp格式后,我遇到了类似的问题。该文件是在xxhdpi文件夹中创建的,未使用。我不记得在我的任何应用程序的xml和java文件中创建或使用photothumbs.db。只需删除photothumbs.db文件即可清除错误。在删除文件之前,为了安全起见,请创建该文件的备份副本。
只需将图像文件扩展名从某些内容(如ico等)更改为png即可。它会工作。