Q:

Proguard + Android Annotations: Can't find superclass or interface javac.annotation.processing.AbstractProcessor

So some people have told me that with Android Studio and the newest version of the Android SDK I should be able to run Proguard on my project, which uses Android Annotations, with no problems. However, I've been struggling with this for many days now.
When I try to run Proguard via the Build->Generate Signed APK tool in Android Studio, I get hundreds of errors of the form:
com.googlecode.androidannotations.annotationprocessor.AnnotatedAbstractProcessor: can't find superclass or interface javax.annotation.processing.AbstractProcessor
com.googlecode.androidannotations.AndroidAnnotationProcessor: can't find referenced method 'void init(javax.annotation.processing.ProcessingEnvironment)' in class com.googlecode.androidannotations.annotationprocessor.AnnotatedAbstractProcessor

I've tried with the built in proguard-android.txt file that comes with the sdk and also with a custom one I copied from Android Annotations, I believe:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
}

I've also tried via gradle on the command line with the same result. Can anyone help me out?

A:

You should probably upgrade your version of Android Annotations. Recent versions make a distinction between

androidannotations-X.Y.jar, for generating the code at compile-time, and
androidannotations-X.Y-api.jar, to be put in the directory libs; containing the code needed at run-time.

This avoids adding classes to the application that depend on classes that are not present in the Android run-time. For instance, ProGuard tries to resolve the dependencies and complains about com.googlecode.androidannotations.annotationprocessor.AnnotatedAbstractProcessor, which depends on the missing javax.annotation.processing.AbstractProcessor.
Side-note: recent versions of the Android SDK use proguard-project.txt instead of proguard.cfg (with the default configuration that you probably copied from the outdated wiki page of Android Annotations). If you update the line with proguard.config in project.properties, the build process automatically applies a default configuration. The file proguard-project.txt can then be empty to start with; it only needs to contain project-specific configuration.

