Android Studio: Where is the Compiler Error Output

2019-01-03 04:52发布

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?

12条回答
相关推荐>>
2楼-- · 2019-01-03 05:10

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

查看更多
做个烂人
3楼-- · 2019-01-03 05:11

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

查看更多
做自己的国王
4楼-- · 2019-01-03 05:13

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

enter image description here

查看更多
▲ chillily
5楼-- · 2019-01-03 05:14

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.

查看更多
放荡不羁爱自由
6楼-- · 2019-01-03 05:14

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.

查看更多
看我几分像从前
7楼-- · 2019-01-03 05:20

It's really straightforward! 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

查看更多
登录 后发表回答