怎么解决android studio libpng error not a png file错误怎么解决

2025-02-25 17:41:32
推荐回答(1个)
回答1:

Information:Gradle tasks [:app3:assembleDebug]
:app3:preBuild
:app3:compileDebugNdk UP-TO-DATE
:app3:preDebugBuild
:app3:checkDebugManifest
:app3:prepareDebugDependencies
:app3:compileDebugAidl UP-TO-DATE
:app3:compileDebugRenderscript UP-TO-DATE
:app3:generateDebugBuildConfig UP-TO-DATE
:app3:generateDebugAssets UP-TO-DATE
:app3:mergeDebugAssets UP-TO-DATE
:app3:generateDebugResValues UP-TO-DATE
:app3:generateDebugResources UP-TO-DATE
:app3:mergeDebugResources
:app3:mergeDebugResources FAILED
C:/Users/Administrator/AndroidStudioProjects/MyApplication3/app3/src/main/res/drawable-hdpi/Chrysanthemum.png
Error:Error: Invalid file name: must contain only lowercase letters and digits ([a-z0-9_.])
Error:Execution failed for task ':app3:mergeDebugResources'.
> C:/Users/Administrator/AndroidStudioProjects/MyApplication3/app3/src/main/res/drawable-hdpi/Chrysanthemum.png: Error: Invalid file name: must contain only lowercase letters and digits ([a-z0-9_.])
这时候是不是感觉很迷茫,出错了对吧,下面就告诉你是怎么回事,怎么出错的。
错误很简单却也很难发觉,原因就是在这张图片上,为什么是图片上呢,刚开始的时候你的图片是不是.jpg格式的,然而你把后缀名改成了.png的以为就可以了是吧,其实不是这样,你只是把格式改成了.png,其实它还是.jpg格式的。要将图片真正转换成.png格式的才行。随便找个图片转换工具就可以解决。

注意:在存放图片时千万不要将格式为.jpg的图片改成.png格式,千万不要偷懒,一定要将格式转换成PNG格式的图片,否则编译将不通过。切记!!!!