最近一个使用android studio开发的项目中在使用了9宫图后出现了编译错误,尝试了多种方法未能解决,最后仔细查看出错的日志发现,居然是图片的原因,图片中包含有alpah通道所以在执行app:mergeDebugResources时出现了错误 ,解决方法就是让美工重新换一张没有alpha通道的9宫图就好了。
information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
AAPT out(1304209106) : No Delegate set : lost message:Done
AAPT err(1304209106): ERROR: 9-patch image M:\project\supervisor-android\app\src\main\res\drawable\chat_left.9.png malformed.
AAPT err(1304209106): Frame pixels must be either solid or transparent (not intermediate alphas).
AAPT err(1304209106): Found at pixel #58 along top edge.
Error:Execution failed for task ‘:app:mergeDebugResources’.
Crunching Cruncher chat_left.9.png failed, see logs
Information:BUILD FAILED
Information:Total time: 1.433 secs
Information:1 error
Information:0 warnings
Information:See complete output in console