You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting with version 2.3.0 the Android Plugin has built-in support for annotation processors.
If you require to use an older version of the plugin you can find an older version of this page explaining the use of android-apt plugin here.
Here is a working sample for Android Plugin 3.4.0:
buildscript {
repositories {
mavenCentral()
}
dependencies {
// replace with the current version of the Android plugin
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
repositories {
mavenCentral()
mavenLocal()
}
apply plugin: 'com.android.application'def AAVersion ='XXX'
dependencies {
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 21
targetSdkVersion 29// If you have different applicationIds for buildTypes or productFlavors uncomment this block.//javaCompileOptions {// annotationProcessorOptions {// arguments = ["resourcePackageName": android.defaultConfig.applicationId]// }//}
}
}
Adding more AA plugins
If you are using more AA plugins, you must declare additional dependencies:
Unlike release builds, where changing the version number to the next will make gradle fetch the new version on while building or assembling, snapshots keep the same version number, and are consequently not updated by gradle.
Thankfully, there's a way to force gradle to update snapshots, but it may take some time, or a while, depending of your connection and the size of the downloaded dependencies. Therefore, you shouldn't run the command below if the current snapshot is already up to date (you can check the recent commits on this repo), or if there's minor changes which don't impact you.
To perform the update, open a terminal in your root project's dir and add the --refresh-dependencies flag to any build gradle command.
Example
As you are using a snapshot version, you are probably building a debug apk, so you can type:
./gradlew assembleDebug --refresh-dependencies
to assemble all your modules and update your project's dependencies, which should include AA's snapshot.