Gradle 日志在哪里? [英] Where are Gradle logs?

查看:116
本文介绍了Gradle 日志在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android Studio 中应用的 Gradle 构建生成以下错误:

Gradle build for an app in Android Studio generates the following error:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.RuntimeException: failure, see logs for details.
cannot generate view binders com.sun.tools.javac.code.Symbol$CompletionFailure: class file for android.view.View$InvalidateInfo not found

谁能提供有关在哪里可以找到日志的提示?

Could anyone offer a tip on where to find the logs?

最初我认为这是一个非常初级的问题,简单的答案会出现在顶部以便快速搜索,但我没有找到.

Initially I thought this was such a rudimentary question that the simple answer would pop up at the top for a quick search, but I failed to find it.

请注意,此问题关于日志,而不是针对此特定错误.此错误消息仅用作示例.如果您好奇,这个特定错误是由于未在 build.gradle 中为 compileSdkVersion 使用最新版本 (23) 引起的.

Please note this question is about the logs, not for this specific error. This error message is used just as an example. In case you are curious, this specific error was caused by not using the latest version (23) for compileSdkVersion in the build.gradle.

推荐答案

Gradle 不会将其日志重定向到 Android Studio 中的单独文件中.

Gradle does not redirect its logs in a separate file in Android Studio.

因此,如果您想在文件中查看它们,则需要在终端中使用命令构建 gradle 并将 gradle 输入重定向到文件.

Therefore if you want to view them in a file, you need to build gradle using a command in the terminal and redirect gradle input to a file.

gradlew build > myLogs.txt 2>&1

此命令会将所有标准输出和错误消息从 gradle 构建重定向到项目文件夹中名为 myLogs.txt 的文件.

This command will redirect all standard output and error messages from gradle build to a file called myLogs.txt in the project folder.

gradlew build > myLogs.txt 2> logErrors.txt

此命令会将 Gradle 日志的所有标准输出重定向到 myLogs.txt,并将所有错误消息重定向到 logErrors.txt

This command will redirect all standard output from Gradle logs to the myLogs.txt and all error messages to logErrors.txt

在 Windows 10 上测试过并且运行完美.

Tested on Windows 10 and works perfectly.

这里是关于如何将标准输出从命令重定向到不同文件的更多信息.

Here is more information about how to redirect standard output from commands to different files.

这篇关于Gradle 日志在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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