Android Studio: Where is the Compiler Error Output Window?
Asked Answered
S

17

329

When I 'Run' my project in Android Studio, in the 'Messages' window, I get:

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. So where is the "compiler error output"? And/Or how do I run with --stacktrace option?

Symptom answered 19/5, 2013 at 11:5 Comment(5)
I run Android Studio 1.3.2 and none of the solutions work.Eldredge
sucki android studio demands such silly questions to be upvoted.. :)Hepburn
maybe it's the idea of IDEA to hide errors ideally (SCNR)Intimacy
I have also same issue when i update plugin . I use Android Studio 3.4 Canary 6Aframe
I have also faced this issue. In my case, The problem lie in entity class data. If your data members are private them must create getter and setter methods. Due to this method other binding issues are coming.Desiraedesire
M
66

This answer is outdated. For Android 3.1 Studio go to this answer

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. You can also open the compiler settings by going to File -> Settings -> Compiler. (Thanx to @maxgalbu for this tip).

enter image description here

Uncheck "Use External build"

enter image description here

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

Monah answered 1/6, 2013 at 20:32 Comment(6)
Unchecking "Use External Build" introduces two errors when I try to build my project: error: duplicate class: com.moberg.colorgame.BuildConfig and error: duplicate class: com.moberg.colorgame.RHexylresorcinol
@Hexylresorcinol Same problem here, I started a new question: #17108893Lucrecialucretia
Ok, I'm going to see what happens and reply in the new question if I find something.Andalusia
I don't have that "messages make" panel... wtf?Bitterling
Thanks. I found an easier way to open the compiler options window: just go to preferences -> compiler, it's the same windowBitterling
I do not see these options now. I am running Android Studio 1.2.1.1Blender
H
565

For Android Studio 3.1, select the icon below the Build one in the Build window.

Android Studio 3.1 raw log toggle button

By Android Studio 3.3 (possibly in 3.2.1), the icon has changed, though the location is the same:

Android Studio 3.3 raw log toggle button

The build window should open when you run a build action (e.g. from the Build menu). If you don't see it, you can try the "Build" button along the bottom of the window (also visible in the above screenshots), or through the menus View → Tool Windows → Build.

Homonym answered 28/12, 2017 at 10:4 Comment(11)
Nice to see that so many has voted for this answer, and Android Studio 3.1 is still in beta 3. :-)Martie
What Icon is that, I can't seem to find it, nor can I find a build windowMelquist
It's sad that I had to google and dig through stackoverflow to find out how to see the compiler output. Thank you @HomonymGaslight
@shikharbansal in case the image link ever breaks again, the icon is on the left edge of the build window. It looks kind of like a list view separated from "ab" by a slash.Dunker
Android's IDE simply says "toggle view".. toggle view of what ? +1 for this answer. Google still doing their best to obscure workflow for developersKerge
I am android programmer for two years and I never knew this existsSpine
Thank you so much, I have been struggling with this issue for like four months... Million thanks,Forcible
Thanks bro, finally among the many answers your answer saved me:)Minni
There seems to be no such icon in AS 4.0Princeling
that Icon is missing on Android studio 4.0Hemminger
in AS 4.0, that icon is AWOL. It seems we are left to manually run the offending Gradle Task from the Gradle Tasks pane, then the Build log will display the log that the previous build log was referring to o.0Torpid
M
66

This answer is outdated. For Android 3.1 Studio go to this answer

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. You can also open the compiler settings by going to File -> Settings -> Compiler. (Thanx to @maxgalbu for this tip).

enter image description here

Uncheck "Use External build"

enter image description here

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

Monah answered 1/6, 2013 at 20:32 Comment(6)
Unchecking "Use External Build" introduces two errors when I try to build my project: error: duplicate class: com.moberg.colorgame.BuildConfig and error: duplicate class: com.moberg.colorgame.RHexylresorcinol
@Hexylresorcinol Same problem here, I started a new question: #17108893Lucrecialucretia
Ok, I'm going to see what happens and reply in the new question if I find something.Andalusia
I don't have that "messages make" panel... wtf?Bitterling
Thanks. I found an easier way to open the compiler options window: just go to preferences -> compiler, it's the same windowBitterling
I do not see these options now. I am running Android Studio 1.2.1.1Blender
G
47

It's really straightforward to set up! Just go to the Compiler settings at Android Studio 2.2.3 and set the --stacktrace command:

Compiler settings to add --stacktrace command

Then run the app again

Granados answered 26/1, 2017 at 17:31 Comment(6)
If it were really straightforward like you say, this thread wouldn't exist.Osteoplastic
@Osteoplastic it's really straightforward to set up, but it is not too obvious to know it :) Changing wording in my answer to make this clearGranados
In AS 4.0, I set this --stacktrace. But where is the output? That was the original question.Princeling
@SteveWhite in the output of the console while building.Granados
Antonio, the expected output never appeared in the build console for me. I had to run gradlew by hand, as explained elsewhere on this page.Princeling
Oh, thanks for letting me know @SteveWhite. Maybe my solution is already out-of-date and not working. I haven't tried it myself lately, but if I come to do it again, I'll update this answer if neededGranados
R
32

Are you on Windows? Launch cmd, find your project folder and run "gradlew build". This should already give you more output than the IDE, you can also use --info, --stacktrace and --debug there.

Radke answered 19/5, 2013 at 11:46 Comment(4)
beautiful! Now if only that output could be integrated into the Android StudioSymptom
My thoughts exactly. An IDE without a window for compiler errors? I bet we are missing something, but this workaround should be enough until that's addressed.Radke
"Are you on windows?" - This also works under Ubuntu Linux too! Thanks! /[folder-where-you-installed-the-android-studio]/sdk/tools/templates/gradle/wrapper/gradlew buildAcronym
I'm in the process of migrating a huge project from Eclipse to Android Studio. Best advise so far: get the command line gradle build working first, then worry about the new IDE.Court
T
19

In my case I prefer to open the Terminal window on the bottom left, and run gradlew build --info :

enter image description here

Tiffanitiffanie answered 19/5, 2016 at 1:0 Comment(2)
@Pamblam Use ./gradlewUnthread
This is the only answer I found on this page that works in AS 4.0Princeling
I
18

You can also see the error in the Build window by clicking on the toggle button.

enter image description here

Indisputable answered 7/7, 2018 at 13:16 Comment(0)
S
12

For Android Studio v4.0

As others have mentioned, the "Messages" window that was evidently present in AS 3.* no longer exists in 4.0 (or else it's hidden very, very well). After wasting far too much time on this, I've found another way to view those compile errors:

  1. Open your Gradle tool window. By default, it's on the right edge toward the top:

enter image description here

If you don't see it there, use View > Tool Windows > Gradle.

  1. In the Gradle window, open your app's root option and run Tasks > build > build:

enter image description here

  1. The Run tool window should open automatically, where you'll see details about the cause of the build error:

enter image description here

If it doesn't open automatically, you can access it through View > Tool Windows > Run.

Hopefully that gives you all the info you need. If not though, try:

  1. Go to File > Settings > Build, Execution, Deployment > Compiler. In the Command-line Options, add --scan.

enter image description here

Apply and OK, then try the Gradle build over again.

Seaward answered 11/7, 2020 at 3:36 Comment(1)
In Android Studio Giraffe | 2022.3.1 to see "build" command it should be manually enabled in Experimental Settings (Preferences -> Experimental -> Configure all Gradle tasks during Gradle Sync). However, after enabling and adding `--scan`` command line option I still can't see cause of the errorCulliton
R
9

In android studio 2.2.3 you can find output in the gradle console as shown below gradle console

Rate answered 9/12, 2016 at 8:22 Comment(1)
In AS 4.0, where is this Gradle Console?Princeling
R
6

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

Rampart answered 6/2, 2016 at 7:8 Comment(1)
I tried this in AS 4.0. I don't know were to look for any output it might have produced.Princeling
G
5

Run

gradlew --stacktrace 

in a terminal to see the full report

for me it was

Task :app:compileDebugJavaWithJavac FAILED javacTask: source release 1.8 requires target release 1.8

so i added

 compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

in app.gradle file / android and the build completed successfully

Garden answered 27/12, 2018 at 22:16 Comment(4)
When I do this in a terminal (within the project folder), it says BUILD SUCCESSFUL But when I build with Build -> Make Project, I see the same notice that there were compilation errors.Princeling
I dont have gradlew installed am i supposed to install a third party app just to check logsSpermatogonium
you don't need to install anything, the file [gradlew] exists in the project main directory just run it.Garden
i missed this ( targetCompatibility JavaVersion.VERSION_1_8 ) thank you its workGuilford
D
4

Just click on the "Build" node in the Build Output

enter image description here

From some reason the "Compilation failed" node just started being automatically selected and for that the description window is very unhelpful.

Dehart answered 10/9, 2020 at 12:43 Comment(0)
L
1

If you are in android studio 3.1, Verify if file->Project Structure -> Source compatibility is empty. it should not have 1.8 set.

then press ok, the project will sync and error will disappear.

Laudian answered 3/4, 2018 at 15:1 Comment(1)
The question was not how to make the error go away. The question was how to see the error messages.Princeling
S
1

In my case i had a findViewById reference to a view i had deleted in xml

if you are running AS 3.1 and above:

  1. go to Settings > Build, Execution and Deployment > compiler
  2. add --stacktrace to the command line options, click apply and ok
  3. At the bottom of AS click on Console/Build(If you use the stable version 3.1.2 and above) expand the panel and run your app again.

you should see the full stacktrace in the expanded view and the specific error.

Smallpox answered 5/5, 2018 at 10:0 Comment(3)
This is AS 4.0. It still fails the same way. No stacktrace.Princeling
Did you add the --stacktrack --debug --info flags ?Smallpox
Sure. But that wasn't the problem. The problem (near as I can tell) there is no longer a window where the stack trace appears. However, it is possible to run gradlew by hand in a terminal to get the info. In another comment on this page, I said which method worked.Princeling
D
0

after the convert android to androidx.

change Import library problem will sol. Like this:

import androidx.appcompat.widget.Toolbar;  <<  like this

import androidx.annotation.NonNull; << like this

import androidx.appcompat.app.ActionBarDrawerToggle; << like this

import androidx.drawerlayout.widget.DrawerLayout; << like this

import androidx.recyclerview.widget.RecyclerView; << like this

import androidx.appcompat.app.AppCompatActivity; << like this

Dunleavy answered 28/4, 2019 at 9:43 Comment(1)
This does not address the OP's question: how to see the compilation errors.Princeling
U
0

Follow these steps!

  1. Go to File

  2. Then click on Settings

  3. Then under "Build, Execution, Deployment" go to Compiler

  4. Add this in "Command-line Options" and press OK enter image description here

  5. Now normally run your test/app again and when you will encounter error this time, you will see highlighted messages like this : enter image description here

  1. Clicking on "Run with --scan" or "Run with --stacktrace" will give error in more detail.
Unfit answered 27/4, 2022 at 0:37 Comment(0)
H
0

Update 2023/2024: this is quite an old question, but for people having this issue in late 2023 the main conclusion from all the answers here and my personal experience is that it's an Android Studio bug that is unable, for some odd reason, to identify an unresolved import which causes the build to fail. The challenge here is to identify manually which import it is that's failing since your IDE friend is leaving you alone at the ring.

You will need to manually go over all of your recent changes backwards until the last point the compilation work and check your imports for a red one which can't be resolved and fix it.

There seems to be multiple reasons causing this issue but it seems to be generally speaking a rare one. For me I was dealing with a couple of conflicts harder than a usual fight between left and right wing political argument. For other people it will be some refactoring in Navigation Component that is not covered by traditional Android Studio refactoring mechanism. Quite annoying, but should not happen often.

Hipolitohipp answered 14/9, 2023 at 12:13 Comment(0)
M
-3

I solved this error "Compilation failed to see the compiler error output for details"

The solution is very Simple: Add in a Gradle below a line of code

implementation 'com.google.android.gms:play-services-ads:15.0.0'

Mortensen answered 7/5, 2019 at 9:56 Comment(2)
Where exactly is the line of code supposed to be added? Could you rephrase?Urmia
This does not answer the original question: how to see the compiler error messages.Princeling

© 2022 - 2024 — McMap. All rights reserved.