Android Studio - mergeDebugResources 异常 [英] Android Studio - mergeDebugResources exception

查看:63
本文介绍了Android Studio - mergeDebugResources 异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将 Android Studio 更新到了最新版本,现在我遇到了 Gradle 构建异常的问题.

I recently updated the Android Studio to it's latest version, and now I am experiencing a headache with an exception in Gradle build.

每次运行项目,两三遍才成功,报错如下:

Every time I run the project, two or three times before it succeed, I get the following error:

Gradle: Execution failed for task ': ProjectName:
mergeDebugResources'.
Java.lang.NullPointerException (no error message)

重试几次后,直到下一次运行才再次发生错误.

After trying again a couple times, the error does not happen again until the next run.

有人知道为什么会这样吗?该项目运行良好,直到更新,之前从未出现任何错误...

Does anybody have any idea of why this is happening? The project worked just fine 'til the update, never got any error before...

谢谢!

推荐答案

我找到了解决问题的方法.

I found a solution to the problem.

有一个关于 gradle 构建问题的问题报告,它不一样,但解决方案似乎也解决了 mergeResourceDebug 问题.(问题在这里https://code.google.com/p/android/issues/detail?id=56158).在评论中指出该解决方案已在 Gradle 0.4.3 中解决.

There is an issue reported about gradle build problems, it is not the same, but the solution seems to solve the mergeResourceDebug issues too. (issue here https://code.google.com/p/android/issues/detail?id=56158). In the comments it is stated that the solution is solved in Gradle 0.4.3.

要使用 Gradle 0.4.3,需要手动更新 build.gradle 文件.(更新 Android Studio 不会改变构建文件)

To use Gradle 0.4.3, the build.gradle file needs to be updated manually. (Updating Android Studio does not change the build file)

这是我在 build.gradle 中更改的内容:

Here is what I changed In build.gradle:

dependencies {
    classpath 'com.android.tools.build:gradle:0.4.3'
}

自从更改此设置后,我在运行我的项目时再也没有看到任何 mergeDebugResource 问题.希望这会有所帮助!

Since changing this, I have not seen any more mergeDebugResource issues when running my project. Hope this helps!

要与 Gradle 保持同步,您可以将版本号更改为 0.4.+

to stay up to date with Gradle you can change the version number to 0.4.+

这篇关于Android Studio - mergeDebugResources 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆