AS常见错误两则

来源:互联网 发布:定格动画软件app 编辑:程序博客网 时间:2024/06/04 00:19

Execution failed for task ‘:mergeDebugResources’

错误2:Execution failed for task ‘:mergeDebugResources’.

Error: Failed to run command:
D:\soft_dev\android-sdk-windows\android-sdk-windows\build-tools\19.1.0\a
apt.exe s -i E:\Aworkspace\NewWorkspace\VipOneToOneGradleTest\res\drawable-xhdpi
\white.png -o E:\Aworkspace\NewWorkspace\VipOneToOneGradleTest\build\intermediat
es\res\debug\drawable-xhdpi-v4\white.png
Error Code:
42
Output:
libpng error: Not a PNG file

解决:这时候是不是感觉很迷茫,出错了对吧,下面就告诉你是怎么回事,怎么出错的。
错误很简单却也很难发觉,原因就是在这张图片上,为什么是图片上呢,刚开始的时候你的图片是不是.jpg格式的,然而你把后缀名改成了.png的以为就可以了是吧,其实不是这样,你只是把格式改成了.png,其实它还是.jpg格式的。要将图片真正转换成.png格式的才行。随便找个图片转换工具就可以解决。

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

  Missing one of the key attributes 'action#name,category#name' on element intent-filter at AndroidManifest.xml:342:13Output:        res\drawable-xhdpi-v4\white.png:0: error: Resource entry white is already defined.        res\drawable-xhdpi-v4\white.jpg:0: Originally defined here.ce\NewWorkspace\Vi 非法字符: \65279

解决:
由于java文件是已utf-8-bom的形式保存的,至于为何导致了这种情况,无需考究,通过editplus打开文件就可以看到。然后另存为utf-8形式就可以了。再将修改了编码的文件替换项目中报错的文件,错误就解决了

FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':lint'.Lint found errors in the project; aborting build.

Fix the issues identified by lint, or add the following to your build script to proceed with errors:

android {    lintOptions {      abortOnError false    }}

解决:这种错误根据英文提示直接解决就可以了

0 0
原创粉丝点击