Android Studio 中 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileDebugAidl'.的问题解答

完整的问题提示

Gradle: 
FAILURE:Build failed with an exception.
*What went wrong:Execution failed for task ':compileDebugAidl'.
>No signature of method: com.android.ide.common.internal.
WaitableExecutor.waitForTasks()is applicable for argument types:()
values:[]Possible solutions: waitForAllTasks()*Try:Runwith--stacktrace
option to
get the stack trace.
Runwith--info or--debug option to get more log output.

但是这个提示我们却不知道干嘛
看了StackOver
http://stackoverflow.com/questions/16682443/android-studio-gradle-build-fails-execution-failed-for-task-compiledebugai
上的解答我是明白了,是要到根目录(也就是找到gradlew.bat这个文件)下运行,打开命令行运行 “gradlew compileDebug --stacktrace"

接着就会出现完整的提示,运行发现居然是字符编码的问题,一口老血喷了一地

测试 了一下,把那些中文改为英文后发现真的没问题了,我的一个下午啊。
问题是知道了,就是我们不能写中文或者把文件换成GBK编码,不然编译的时候是会以GBK编码编译的,然后就出错。
但是咱们是中国人啊,不能不写中文啊。我继续找,最后在这篇博客上找到了解决方案
http://blog.csdn.net/nono_love_lilith/article/details/9041813
具体就是在下图中红色圈圈的 build.gradle 文件中添加一个东西,就是下面这个,让它以UTF-8的方式编译

  tasks.withType(Compile) {
    options.encoding = "UTF-8"
}

就是在最后加入就可以了,最后编译通过,还是要默哀一下我的下午。还有仇视一下这坑爹的IDE
难怪大神们一般都不用IDE

原文地址:https://www.cnblogs.com/Jabba93/p/3125106.html