Configuring Your Android Build
To get started, add the Micronaut annotation processors to the processor classpath using the annotationProcessor
dependency configuration.
Include the Micronaut micronaut-inject-java
dependency in both the annotationProcessor
and compileOnly
scopes of your Android build configuration:
Example Android build.gradle
dependencies {
...
annotationProcessor "io.micronaut:micronaut-inject-java:3.0.0"
compileOnly "io.micronaut:micronaut-inject-java:3.0.0"
...
}
If you use lint
as part of your build you may also need to disable the invalid packages check since Android includes a hard-coded check that regards the javax.inject
package as invalid unless you use Dagger:
Configure lint within build.gradle
android {
...
lintOptions {
lintOptions { warning 'InvalidPackage' }
}
}
You can find more information on configuring annotations processors in the Android documentation.
Micronaut inject-java dependency uses Android Java 8 support features. |