您的位置:首页 > 移动开发

Error:Execution failed for task ':app:processDebugResources'.个人已解决

2018-03-17 13:59 363 查看
个人问题出现场景:在编写ListView列表时,主类中初始化数据时,R报错,找不到该资源文件
个人问题出现原因:是res资源下drawable文件夹中放置的图片有问题。(Goole了一下,发现每个人问题可能不一样)
drawable官方文档说明

Drawable Resources

SEE ALSO

2D Graphics
A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as 
getDrawable(int)
 or apply to another XML resource with attributes such as 
android:drawable
 and 
android:icon
. There are several different types of drawables:Bitmap: the simplest Drawable, a PNG or JP
4000
EG image.
Nine Patch: an extension to the PNG format allows it to specify information about how to stretch it and place things inside of it.
Shape: contains simple drawing commands instead of a raw bitmap, allowing it to resize better in some cases.
Layers: a compound drawable, which draws multiple underlying drawables on top of each other.
States: a compound drawable that selects one of a set of drawables based on its state.
Levels: a compound drawable that selects one of a set of drawables based on its level.
Scale: a compound drawable with a single child drawable, whose overall size is modified based on the current level.

①个人当时编写代码时比较匆忙,没有提前准备好相应的图片,就找了电脑里几张喜欢的图片,复制粘贴在drawable下,在代码中R资源文件爆红,显示找不到,在引入资源时R文件发生报错,报错查看locat之后发现原因:drawable图片尺寸过大;


②紧接着,删除了过大的图片,又试着找了几张图标图,结果依然R文件报错,locat中显示Error:Execution failed for task ':app:processDebugResources'。带着问题查找了官方文档,最终发现是drawable文件夹下面的图片资源文件错误。删除之后,程序正常运行,列表也显示成功。
Error:Execution failed for task ':app:processDebugResources'——每个人出现问题的原因可能不同,针对locat给出的提示,在结合官方API文档,去查找对应的解决办法。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐