当我在Android Studio中“运行”我的项目时,在“消息”窗口中,我得到:

Gradle: 
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':play01:compileDebug'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

它说>编译失败;有关详细信息,请参阅编译器错误输出。 那么“编译器错误输出”在哪里呢?我如何运行——stacktrace选项?


当前回答

您还可以通过单击切换按钮在Build窗口中看到错误。

其他回答

您还可以通过单击切换按钮在Build窗口中看到错误。

我是基于乔治的建议。 转到文件- >设置- >编译器。

在这里,您将看到一个用于添加编译器选项的字段——stacktrace

在我的情况下,我更喜欢打开左下角的终端窗口,并运行gradlew build——info:

如果您在android studio 3.1中,验证文件->项目结构->源兼容性是否为空。它不应该有1.8集。

然后按ok,项目将同步,错误将消失。

在android studio 2.2.3中,你可以在gradle控制台中找到如下所示的输出