Compiler options missing in Android Studio >= 0.8.2
Asked Answered
F

3

10

Recently I upgraded my Android Studio to 0.8.2. Now, my android-annotations based project fails to build. It seems like annotation processing is disabled somehow. It seems the project compiler settings have been changed, the option to turn annotation processing on/off is nowhere to be found...

Compiler settings in 0.8.2

I can't expand the 'Compiler' option as I could before:

Expected compiler settings

Where have they put these options?

Farley answered 16/7, 2014 at 18:7 Comment(2)
Ok, this is just weird. I restarted Android Studio, reopened my project and now I have two 'Compiler' options, both options as shown in the screens above...Farley
So only restart has solved your problem or maybe some additional acitons? Even after restart I still have this issue like (Compiler(Gradle-based Android Projects)) etc. and only one tab.Tarragona
R
11

This is a little late, but for me, it's under

File -> Other Settings -> Default Settings -> Compiler

This compiler has dropdown options, including Annotation Processors.

Reservoir answered 4/2, 2015 at 2:45 Comment(2)
There is no Default Settings under Other Settings in A.S. anymore.Gnawing
It's moved to File -> New Projects SetupMullein
H
3

In Android Studio 3.1.2 this setting is under:

File -> Other Settings -> Default Settings... -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Additional command line parameters

enter image description here


Update

For more recent versions of Android Studio [tested on Android Studio 3.5 but probably starting from 3.4 according to Joel's comment] this setting is under:

File -> Other Settings -> Settings for New Projects... -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Additional command line parameters


For existing projects it seems to me that the only option is to implement the solution described in these two answers A1 and A2, modifying the build.gradle file wrapping around allprojects or not based on your needs:

allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }
}

More details about Gradle's Multi-Project Builds can be found here on their official website

Horrorstruck answered 4/6, 2018 at 7:52 Comment(4)
With Open Studio 3.4.2 under Linux, I can't find the Java compiler options in any of these places. I would like to add the -Xlint:deprecation option to find out which API is obsolete when compiling code for bluetooth. The Compiler options I found in the "Build, execution, deployment" settings obviously only apply to Gradle. Does anybody know where to set the Java compiler options now?Stereography
@JoëlV. I just updated this answer, check now if it works for you [tested on the last Android Studio 3.5 for Windows but theoretically should be identical on Linux]Horrorstruck
update is about "new projects", what about the current projectVerwoerd
@Verwoerd I just updated the answer again, let me know if it solves your issue or notHorrorstruck
D
0

This option now is moved to:

File -> Settings -> Build, Execution, Deployment -> Gradle-Android Compiler -> Command-line Options:

Screen of settings

Dressel answered 8/11, 2023 at 16:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.