Android Studio:编译器错误输出窗口在哪里?

在Android Studio中,当项目运行时,错误输出通常显示在'Messages'窗口中。用户可以通过停用外部构建、添加编译器选项或在Gradle控制台查看输出来获取更详细的编译错误信息。
摘要由CSDN通过智能技术生成

本文翻译自:Android Studio: Where is the Compiler Error Output Window?

When I 'Run' my project in Android Studio, in the 'Messages' window, I get: 当我在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.

It says > Compilation failed; see the compiler error output for details. 它说> Compilation failed; see the compiler error output for details. > Compilation failed; see the compiler error output for details. So where is the "compiler error output"? 那么“编译器错误输出”在哪里? And/Or how do I run with --stacktrace option? 和/或如何使用--stacktrace选项运行?


#1楼

参考:https://stackoom.com/question/17NfC/Android-Studio-编译器错误输出窗口在哪里


#2楼

Are you on Windows? 你在Windows上吗? Launch cmd, find your project folder and run "gradlew build". 启动cmd,找到您的项目文件夹并运行“gradlew build”。 This should already give you more output than the IDE, you can also use --info, --stacktrace and --debug there. 这应该已经提供了比IDE更多的输出,你也可以在那里使用--info, - stacktrace和--debug。


#3楼

This answer is outdated. 这个答案已经过时了。 For Android 3.1 Studio go to this answer 对于Android 3.1 Studio,请转到此答案

One thing you can do is deactivate the external build. 您可以做的一件事是停用外部版本。 To do so click on "compiler settings icon" in the "Messages Make" panel that appears when you have an error. 为此,请在出现错误时出现的“Messages Make”面板中单击“编辑器设置图标”。 You can also open the compiler settings by going to File -> Settings -> Compiler. 您也可以转到文件 - >设置 - >编译器打开编译器设置。 (Thanx to @maxgalbu for this tip). (对于此提示,请与@maxgalbu合作)。

在此输入图像描述

Uncheck "Use External build" 取消选中“使用外部版本”

在此输入图像描述

And you will see the errors in the console 您将在控制台中看到错误

EDIT: After returning to "internal build" again you may get some errors, you can solve them this way: Android Studio: disabling "External build" to display error output create duplicate class errors 编辑:再次返回“内部构建”后,您可能会遇到一些错误,您可以通过这种方式解决它们: Android Studio:禁用“外部构建”以显示错误输出会产生重复的类错误


#4楼

I am building on what Jorge recommended. 我正在建立在豪尔赫推荐的基础上。 Goto File->Settings->compiler. 转到文件 - >设置 - >编译器。

Here you will see a field to add compiler options where you plug in --stacktrace 在这里,您将看到一个字段,用于在插入--stacktrace时添加编译器选项


#5楼

In my case I prefer to open the Terminal window on the bottom left , and run gradlew build --info : 在我的情况下,我更喜欢打开左下角终端窗口 ,并运行gradlew build --info

在此输入图像描述


#6楼

In android studio 2.2.3 you can find output in the gradle console as shown below 在android studio 2.2.3中,您可以在gradle控制台中找到输出,如下所示 gradle控制台

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值