Reputation: 18531
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.
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.
Upvotes: 117
Views: 110278
Reputation: 137
Ashakirov's answer is almost the ultimate one. Just a little update, in newer Andy Studio release, e.g. Dolphin (2021.3.1 Patch 1), the "/ab" icon is gone. "Build Analyzer" is a new tab introduced in "Build" tool window, to take place of "/ab". Just select and run "Build"->"Rebuild Project" from the menu, and after the build finish, choose "Tasks" option from the top-left drop-box in "Build Analyzer" tab in "Build" winodw, and Andy Studio will show all the Gradle tasks been run in the build.
P.S. Ajaxian's answer is good for CLI in "Terminal" window though.
Upvotes: 1
Reputation: 4331
In Android Studio 4 (at least 4.2.1 now), both the ab
button and the Toggle View
button (mentioned in another answer) are gone, so Android Studio doesn't show the logs in the Build View anymore, but if a gradle sync fails, there is a button that brings you to view the idea log outside Android Studio (see the right-most button below), entitled "Show Log in Finder" (at least, in MacOS Android Studio).
Upvotes: 5
Reputation: 728
In the Windows version of Android Studio, there should be a "Show Log in Explorer" link that will reveal the Gradle log:
Upvotes: 0
Reputation: 12360
View -> Tool Windows -> Build.
There is small "ab" button on the left panel.
All gradle logs for current build are there.
EDIT: There is new icon from AndroidStudio 3.3
Upvotes: 48
Reputation: 309
You can also try running your task like this:
>gradlew --info build
You will get a bunch of useful log information
Upvotes: 28
Reputation: 1754
Gradle does not redirect its logs in a separate file in Android Studio.
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
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
This command will redirect all standard output from Gradle logs to the myLogs.txt and all error messages to logErrors.txt
Tested on Windows 10 and works perfectly.
Here is more information about how to redirect standard output from commands to different files.
Upvotes: 96