I am trying to use Java 8 in my project and I have added a jack compiler for this project.
I started having problems with libraries that use annotation processing after powering on the socket, and while searching the web I read that I needed android studio 2.2 and com.android.tools.build:gradle:2.2.0-alpha6 to compile libraries that generate code from annotations.
I downloaded Android Studio 2.2 Preview 6 and converted my project to it. And then I discovered that the apt gradle plugin is no longer supported, and I had to adjust all dependencies that apt uses to use the new annotationProcessor option.
at the following address:
Now, if I use make project, the project compiles without problems, but if I try to run it, I get errors with the code to be generated by the notes.
I also get a warning from the Lombok plugin when I open a project. The editing of the annotations seems to have been disabled for the project. If I open the project settings and go to Build -> Compile, I can’t find the annotation processors.
So my question is this one: How do I turn on the annotation processor in Android Studio 2.2? Is this function disabled? If so, how do I generate a code from the notes?
I made a PullRequest to customize the project to compile with Java8, you can see the PR here: https://github.com/jonathanrz/myexpenses-android/pull/57.
How can I solve this problem?
Shut down the project. In the Welcome to Android Studio dialog box, click the Customize button in the lower right corner.
Settings > Build, Execute, Deploy > Compiler > Annotation Processors. Select the Enable Annotation Processing check box.
If this doesn’t work. Remove the project from the Welcome to Android Studio dialog box and open it in a new dialog box.
It worked for me.
- Close all your AndroidStudio projects
- See .
- Click on Configuration>Configuration
In Android Studio 2.3, you can enable annotation processors without shutting down the project:
File -> Other settings -> Default settings
Build, Execute, Deploy -> Compile -> Annotation Processors ->
Activate annotation processing.
Don’t forget to remove, embroider, undo and restart.
and after that: Folder > Invalid Caches / Restart > Invalid and reset
Solution No 5:
Open the compiler.xml file in the .idea folder. Here’s what I’ve got:
I just changed the resolution to a real and reopened resolution.
Solution No 6:
- Shut down your project.
- Settings > Build, Execute, Deploy > Compiler > Annotation Processors. Select the Enable Annotation Processing check box.
- Open your project.
- File > Invalid Cache / Restart… > Fake and reset
Wait until the process is complete, then everything will be fine.
Solution No 7:
Addendum to @Jacques Fever and @mtrakal
If you do not have access to the Welcome to Android Studio screen. Try to close File -> Project instead of clicking on the X icon. You will get the Welcome to Android Studio screen and you will see the material in the lower right corner. Then you have to follow the accepted answer and possibly cancel the cache.
Solution No 8:
This answer is intended for those who will have to deal with this problem in the future.
Add a capture plugin
Application Plugin : kotlin-cut
Implementation of ‘com.google.dagger:dagger:2.21’
Execution ‘com.google.dagger:dagger:2.21’ annotation
Solution No 9:
Done, but it worked for me, try to upgrade the library version in my case I upgraded to 1.4.1
Solution No 10:
Sometimes the annotation option is gray if the project is not integrated with version control. So go to VCS->Enable Version Control Integration, then you will see the annotation option and you will see the name of the author next to the line number in the editor.