Search code examples
androidandroid-studioandroid-studio-2.3

How to enable Annotation Processor in Android Studio 2.3


This is the error notification I'm getting This is the Error

And when I go to the described Location I cant find it

enter image description here


Solution

  • You have to close the project and access to the default preferences from the "Welcome to Android Studio" page and you will can find the "Annotation Processors" section.
    More info at other questions about Android 2.2 (for example enable Annotation Processors option in Android Studio 2.2) where you can also find other tips like removing al projects from welcome page, using invalidate cache and restart and so on.
    Anyway it seems that Lombok APT properly runs regardless of the boring message. The bug has been already issued at https://github.com/mplushnikov/lombok-intellij-plugin/issues/264.

    I finally have found the tweak!
    It seems that the problem is when you create the project before enabling annotation processors.
    Exit from Android Studio and edit the file <your project folder>/.idea/compiler.xml.
    You should find:

    <?xml version="1.0" encoding="UTF-8"?>
    <project version="4">
        <component name="CompilerConfiguration">
            ...
            <annotationProcessing>
                <profile default="true" name="Default" enabled="false">
                    <processorPath useClasspath="true" />
                </profile>
            </annotationProcessing>
        </component>
    </project>
    

    You should set enabled to true and the boring message disappears!

    <?xml version="1.0" encoding="UTF-8"?>
    <project version="4">
        <component name="CompilerConfiguration">
            ...
            <annotationProcessing>
                <!-- This is the line where to set enabled to true  -->
                <profile default="true" name="Default" enabled="true">
                    <processorPath useClasspath="true" />
                </profile>
            </annotationProcessing>
        </component>
    </project>