报错信息如下:
so,打开gradle console控制台,发现错误详细如下:
Executing tasks: [:sortListViewDemo:assembleDebug]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:sortListViewDemo:preBuild UP-TO-DATE
:sortListViewDemo:preDebugBuild UP-TO-DATE
:sortListViewDemo:checkDebugManifest
:sortListViewDemo:prepareDebugDependencies
:sortListViewDemo:compileDebugAidl UP-TO-DATE
:sortListViewDemo:compileDebugRenderscript UP-TO-DATE
:sortListViewDemo:generateDebugBuildConfig UP-TO-DATE
:sortListViewDemo:generateDebugResValues UP-TO-DATE
:sortListViewDemo:generateDebugResources UP-TO-DATE
:sortListViewDemo:mergeDebugResources
Error: java.lang.RuntimeException: Some file crunching failed, see logs for details
:sortListViewDemo:mergeDebugResources FAILED
**AAPT err(Facade for 972347635): ERROR: 9-patch image D:\GitWorkSpace\MyAndroidStudy\sortListViewDemo\src\main\res\drawable\search_bar_edit_normal.9.png malformed.
AAPT err(Facade for 972347635): Frame pixels must be either solid or transparent (not intermediate alphas).
AAPT err(Facade for 972347635): Found at pixel #15 along top edge.
AAPT err(Facade for 1299302347): ERROR: 9-patch image D:\GitWorkSpace\MyAndroidStudy\sortListViewDemo\src\main\res\drawable\search_bar_edit_pressed.9.png malformed.
AAPT err(Facade for 1299302347): Frame pixels must be either solid or transparent (not intermediate alphas).
AAPT err(Facade for 1299302347): Found at pixel #15 along top edge.**
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sortListViewDemo:mergeDebugResources'.
> Error: java.lang.RuntimeException: Some file crunching failed, see logs for details
* 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: 1.339 secs
原因:图片中包含有alpha通道所以在执行app:mergeDebugResources时出现了错误
解决方案:让UI同学重新切一张没有alpha通道的图即可。