For some reason javax.annotation.processing
package is missing.
I found this stackoverflow post about the same issue, but it gives broken link as answer. Have tried some stuff that google suggest, but with no results.
Asked
Active
Viewed 2,553 times
4

Community
- 1
- 1

somerandomusername
- 1,993
- 4
- 23
- 55
3 Answers
18
I assume that you want to write annotation processor in Android Studio and have a very common project structure in this case: Android app, Java lib with @interface
definitions and Java lib with AbstractProcessor
subclasses.
I ran into the same problem and one thing helped:
- Completely remove your Java module from project layout.
- Make sure that only your code survives, delete all (or maybe just
.iml
file would suffice?) other stuff in module directory. - Add your sources again as module
Java Library
. Everything should work now.
I think that was because first I added module as Android library, then manually changed it to look like Java library (default structure for gradle java plugin). But .iml
was from Android lib module structure anyway.

Vsevolod Ganin
- 623
- 8
- 22
-
This is exactly perfect solution for the question. `Java Library` can use `javax`, I followed this solution and it works! – Stanley Ko Oct 11 '19 at 01:40
0
The solution is given by vganin above. My problem was that I created an Android Library Project (mistakenly) and not Java Library Project.

Szabolcs Becze
- 507
- 1
- 5
- 10
0
In my case I was using the android library plugin and the base plugin together:
plugins {
id 'com.android.library'
id 'base'
}
This works:
plugins {
id 'com.android.library'
}

k_o_
- 5,143
- 1
- 34
- 43