ChatGPT解决这个技术问题 Extra ChatGPT

Android Studio: Where is the Compiler Error Output Window?

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?

I run Android Studio 1.3.2 and none of the solutions work.
sucki android studio demands such silly questions to be upvoted.. :)
maybe it's the idea of IDEA to hide errors ideally (SCNR)
I have also same issue when i update plugin . I use Android Studio 3.4 Canary 6
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.

o
outis

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

https://i.stack.imgur.com/X5Gfr.png

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

https://i.stack.imgur.com/q9iRT.png

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.


What Icon is that, I can't seem to find it, nor can I find a build window
It's sad that I had to google and dig through stackoverflow to find out how to see the compiler output. Thank you @boiledwater
Android's IDE simply says "toggle view".. toggle view of what ? +1 for this answer. Google still doing their best to obscure workflow for developers
There seems to be no such icon in AS 4.0
that Icon is missing on Android studio 4.0
J
Jorge Fuentes González

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).

https://i.stack.imgur.com/DJw9e.png

Uncheck "Use External build"

https://i.stack.imgur.com/FyLEr.png

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


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.R
@Moberg Same problem here, I started a new question: stackoverflow.com/questions/17108393/…
Ok, I'm going to see what happens and reply in the new question if I find something.
I don't have that "messages make" panel... wtf?
I do not see these options now. I am running Android Studio 1.2.1.1
A
Antonio

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

https://i.stack.imgur.com/VI0wp.png

Then run the app again


If it were really straightforward like you say, this thread wouldn't exist.
@jungledev it's really straightforward to set up, but it is not too obvious to know it :) Changing wording in my answer to make this clear
In AS 4.0, I set this --stacktrace. But where is the output? That was the original question.
@SteveWhite in the output of the console while building.
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.
H
Hadi Kocabas

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.


beautiful! Now if only that output could be integrated into the Android Studio
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.
"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 build
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.
R
RominaV

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

https://i.stack.imgur.com/4N5yj.png


@Pamblam Use ./gradlew
This is the only answer I found on this page that works in AS 4.0
l
live-love

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

https://i.stack.imgur.com/ui6SQ.png


k
kittykittybangbang

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:

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

https://i.stack.imgur.com/vepRT.png

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

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

https://i.stack.imgur.com/4ZWut.png

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

https://i.stack.imgur.com/7s7Ir.png

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:

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

https://i.stack.imgur.com/fse2n.png

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


c
cahit beyaz

https://i.stack.imgur.com/0YIag.png


In AS 4.0, where is this Gradle Console?
j
jai

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


I tried this in AS 4.0. I don't know were to look for any output it might have produced.
F
Falah H. Abbas

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


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.
I dont have gradlew installed am i supposed to install a third party app just to check logs
you don't need to install anything, the file [gradlew] exists in the project main directory just run it.
i missed this ( targetCompatibility JavaVersion.VERSION_1_8 ) thank you its work
J
Jan Málek

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

https://i.stack.imgur.com/YamGB.png

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


L
Logesh R

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.


The question was not how to make the error go away. The question was how to see the error messages.
P
Peterstev Uremgba

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:

go to Settings > Build, Execution and Deployment > compiler add --stacktrace to the command line options, click apply and ok 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.


This is AS 4.0. It still fails the same way. No stacktrace.
Did you add the --stacktrack --debug --info flags ?
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.
A
AhmadUllah Ahmad

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


This does not address the OP's question: how to see the compilation errors.
o
oyeraghib

Follow these steps!

Go to File Then click on Settings Then under "Build, Execution, Deployment" go to Compiler Add this in "Command-line Options" and press OK Now normally run your test/app again and when you will encounter error this time, you will see highlighted messages like this :

Clicking on "Run with --scan" or "Run with --stacktrace" will give error in more detail.


S
Shah Hussain

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'


Where exactly is the line of code supposed to be added? Could you rephrase?
This does not answer the original question: how to see the compiler error messages.