Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

AA not kicking in with Gradle 4.1 and Gradle Android Plugin Version 3.0-alpha 5 #2024

@kashban

Description

@kashban

AndroidAnnotations version:

4.3.1

Android compile SDK version:

25

Annotated code:
Several classes but AA is not generating anything at all.

My build.gradle:


buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
        jcenter()
    }
}

apply plugin: 'com.android.application'
//apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.3.1'
def GooglePlayVersion = '11.0.2'
def AndroidSupportVersion = '25.4.0'
def CompileSdkVersion = 25

ext.androidAnnotationsVersion = '4.3.1';

configurations {
    apt
    implementation.exclude group: "org.apache.httpcomponents", module: "httpclient"
}


android {
    dataBinding {
        enabled=true
    }

    flavorDimensions "production", "debug"

    signingConfigs {
        release {
            storeFile file("../AndroidKeyStore")
            storePassword "xxx"
            keyAlias "juergenwahlmann"
            keyPassword "xxx"
            v2SigningEnabled false
        }
        debug {
            storeFile file("../AndroidKeyStore")
            storePassword "xxx"
            keyAlias "juergenwahlmann"
            keyPassword "xxx"
            v2SigningEnabled false
        }
    }
    compileSdkVersion 25
    buildToolsVersion '26.0.0'
    defaultConfig {
        applicationId 'de.kashban.android.picturecalendar'
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 317
        versionName '3.1.7'
        multiDexEnabled true

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["logLevel": "TRACE",
                             "logAppenderConsole": "true",
                             "resourcePackageName": android.defaultConfig.applicationId
                             ]
                //className 'org.androidannotations.androidannotations'
            }
        }
        signingConfig signingConfigs.debug
    }

    useLibrary 'org.apache.http.legacy'

    // AA: if you are going to use the spring rest template with AA
    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
    }
    productFlavors {
        production {
            applicationId = 'de.kashban.android.picturecalendar'
            minSdkVersion 19
            signingConfig signingConfigs.release
            targetSdkVersion 25
            dimension 'production'
        }
        development {
            applicationId = 'de.kashban.android.picturecalendar'
            minSdkVersion 19
            signingConfig signingConfigs.debug
            dimension 'debug'
        }
    }

    buildTypes.debug {
        minifyEnabled false
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }

    buildTypes.release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    // AA imports (also enables REST support w AA)!!
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    implementation "org.androidannotations:androidannotations-api:$AAVersion"
    implementation 'com.google.http-client:google-http-client-jackson2:1.20.0'
    implementation 'com.google.apis:google-api-services-drive:v2-rev171-1.20.0'
    implementation "com.google.android.gms:play-services-auth:$GooglePlayVersion"
    implementation "com.google.android.gms:play-services-identity:$GooglePlayVersion"
    implementation "com.google.android.gms:play-services-plus:$GooglePlayVersion"
    implementation "com.google.android.gms:play-services-base:$GooglePlayVersion"
    implementation "com.google.android.gms:play-services-analytics:$GooglePlayVersion"
    implementation "com.google.android.gms:play-services-drive:$GooglePlayVersion"
    implementation "com.google.android.gms:play-services-ads:$GooglePlayVersion"
    implementation 'com.google.apis:google-api-services-analytics:v2.4-rev93-1.20.0'
    implementation('com.google.api-client:google-api-client-android:1.18.0-rc') {
        exclude group: 'xpp3'
        exclude group: 'com.google.android.google-play-services'
        exclude group: 'org.apache.httpcomponents'
        exclude group: 'com.google.android'
    }
    implementation('com.google.http-client:google-http-client:1.18.0-rc') {
        exclude group: 'xpp3'
        exclude group: 'com.google.android.google-play-services'
        exclude group: 'org.apache.httpcomponents'
        exclude group: 'com.google.android'
    }
    implementation "com.android.support:support-v4:$AndroidSupportVersion"
    implementation "com.android.support:support-v13:$AndroidSupportVersion"
    implementation "com.android.support:appcompat-v7:$AndroidSupportVersion"
    implementation "com.android.support:gridlayout-v7:$AndroidSupportVersion"
    implementation "com.android.support:cardview-v7:$AndroidSupportVersion"
    implementation "com.android.support:palette-v7:$AndroidSupportVersion"
    implementation "com.android.support:design:$AndroidSupportVersion"
    implementation "com.android.support:recyclerview-v7:$AndroidSupportVersion"
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'com.patrickpissurno:ripple-effect:1.3.1'
    implementation 'com.afollestad.material-dialogs:core:0.9.4.4'
    implementation 'com.github.jrejaud:ViewPagerIndicator2:0.0.2'
    implementation project(':pictureCalendarLibrary')
    implementation project(':aFileChooser')
    //implementation 'andhradroid.dev:aFilechooser:1.0.1'
    implementation 'com.github.yukuku:ambilwarna:2.0.1'
    implementation 'com.github.androidquery:androidquery:0.26.9'
    implementation 'com.github.piruin:quickaction:2.3'
    implementation 'com.github.jayschwa:AndroidSliderPreference:v1.0.0'
    implementation 'com.daimajia.easing:library:2.0@aar'
    implementation 'com.daimajia.androidanimations:library:2.2@aar'
    implementation 'com.github.castorflex.smoothprogressbar:library:1.0.0'
    implementation 'com.makeramen:roundedimageview:2.2.1'
    implementation('com.mikepenz:aboutlibraries:5.9.6@aar') {
        transitive = true
    }
    implementation 'com.github.nirhart:parallaxscroll:1.0'
    implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'
    implementation 'com.jayway.android.robotium:robotium-solo:5.6.3'
    implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
    implementation 'com.dmitrymalkovich.android:material-design-dimens:1.4'
}

def getSourceSetName(variant) {
    return new File(variant.dirName).getName();
}

android.applicationVariants.all { variant ->
    def aptOutputDir = project.file("build/source/apt")
    def aptOutput = new File(aptOutputDir, variant.dirName)
    println "****************************"
    println "variant: ${variant.name}"
    println "manifest:  ${variant.outputs[0].processResources.manifestFile}"
    println "aptOutput:  ${aptOutput}"
    println "****************************"

    android.sourceSets[getSourceSetName(variant)].java.srcDirs+= aptOutput.getPath()

    variant.javaCompiler.options.compilerArgs += [
            '-processorpath', configurations.apt.getAsPath(),
            '-AandroidManifestFile=' + variant.outputs[0].processResources.manifestFile,
            '-s', aptOutput
    ]

    variant.javaCompiler.source = variant.javaCompiler.source.filter { p ->
        return !p.getPath().startsWith(aptOutputDir.getPath())
    }

    variant.javaCompiler.doFirst {
        aptOutput.mkdirs()
    }
}

Expected generated code:
Generated Classes in class path

Actual generated code:
Nothing

compiler.xml

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CompilerConfiguration">
    <wildcardResourcePatterns>
      <entry name="!?*.java" />
      <entry name="!?*.form" />
      <entry name="!?*.class" />
      <entry name="!?*.groovy" />
      <entry name="!?*.scala" />
      <entry name="!?*.flex" />
      <entry name="!?*.kt" />
      <entry name="!?*.clj" />
    </wildcardResourcePatterns>
    <annotationProcessing>
      <profile default="true" name="Default" enabled="true" >
		<processorPath useClasspath="true" />
	  </profile>
    </annotationProcessing>
  </component>
</project>

I migrated from APT to Android Annotation Processor to make use of the newer Gradle build system.

As far as I can tell the Annotation Processor is not activated at all because I don't see any generated classes in my project.

Databinding Processing seems to work. If I set a className for the annotation processor in my build.gradle at least I get a message that it could not be found (because I don't know the exact class name for org.androidannotations).

Any hints?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions