The javax.annotation.processing package for Android is missing. Cannot use AbstractProcessor

The package is javax.annotation.processing

missing for some reason . I found this StackOverflow question about the same problem, but it gives a broken link as an answer. Have tried some of the things that Google has to offer but no results.

+3


source to share


2 answers


I assume you want to write an annotation handler in Android Studio and have a very general project structure in this case: Android application, Java lib with definitions, @interface

and Java lib with subclasses AbstractProcessor

.

I faced the same problem and one thing helped:



  • Remove your Java module completely from the project layout.
  • Make sure to keep only your code, delete all (or maybe just a file .iml

    ?) Other stuff in the module directory.
  • Add your sources again as a module Java Library

    . Everything should work now.

I think it was because I first added the module as an Android library and then manually changed it to look like a Java library (default framework for gradle java plugin). But .iml

it belonged to the libb module structure anyway.

+14


source


The solution is given by the vagan above. My problem was that I created an Android library project (by mistake) and not a Java library project.



0


source







All Articles