Breaking

Friday 19 April 2019

Compilation failed; see the compiler error output for details | Android Tutorial

Compilation failed; see the compiler error output for details.

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?

Answer :- 1

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.



Uncheck "Use External build"






And you will see the errors in the console

Answer :2


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



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



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.

Answer :3



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.


No comments:

Post a Comment