gradle打包遇到的错误汇总

错误1:A problem occurred evaluating root project 'VipOneToOne1.5_29'.org/gradle/tooling/provider/model/ToolingModelBuilderRegistry


> SDK location not found. Define location with sdk.dir in the local.properties f
ile or with an ANDROID_HOME environment variable.
解决:
http://stackoverflow.com/questions/19794200/gradle-android-and-the-android-home-sdk-location


错误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格式的图片,否则编译将不通过。切记!!!!

错误3:  Missing one of the key attributes 'action#name,category#name' on element
 intent-filter at AndroidManifest.xml:342:13
Output:
        res\drawable-xhdpi-v4\white.png:0: error: Resource entry white is alread
y defined.
        res\drawable-xhdpi-v4\white.jpg:0: Originally defined here.

ce\NewWorkspace\Vi
 非法字符: \65279

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

错误4:
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
    }
}

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


overstackflow 上的解决办法:

http://stackoverflow.com/questions/15963783/proguard-parseexception-expecting-class-member-name-before-in-android-eclip

实质在打包的过程不仅仅出现了上述几种错误,开始的时候做了记录,后来发现,所有的错误,根据报错的日志,追踪,都可以得到解决。就没有一一记录了。

你可能感兴趣的:(android开发)