android-studioandroid-gradle-pluginandroid-buildandroid-aptandroid-variants

Unable to Upgrade my android code to gradle 3.5.3 while using android-apt


I am unable to upgrade code to gradle 3.5.3 when I tried a lot of error occurs.

here my old code app.gradle

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.3'
    defaultConfig {
        applicationId "com.fiapps.alquran.tafseer"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }


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

        debug {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
        resourcePackageName android.defaultConfig.applicationId
    }
}

dependencies { 
    apt "org.androidannotations:androidannotations:3.2" 
    compile "org.androidannotations:androidannotations-api:3.2"
    compile 'com.android.support:appcompat-v7:25.4.0'
    compile 'com.android.support:support-v4:25.4.0'
    compile 'com.squareup:otto:1.3.8'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'commons-io:commons-io:2.4'
    compile 'com.koushikdutta.ion:ion:2.1.8'
    compile 'com.google.code.gson:gson:2.8.2'
}

and this old project.gragle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.7.0'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

repositories {
    mavenLocal()
    mavenCentral()
}

my updated code app.gradle but still give a lot of issues

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "my.package.here"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true
            }
        } 

        applicationVariants.all { variant ->
            variant.variantData.variantConfiguration.javaCompileOptions.annotationProcessorOptions.arguments =
                    ['androidManifestFile': variant.outputs[0]?.processResources?.manifestFile?.absolutePath,
                     'resourcePackageName': android.defaultConfig.applicationId]
        }

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

        debug {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

} 
dependencies {
    implementation "org.androidannotations:androidannotations:4.6.0"
    implementation "org.androidannotations:androidannotations-api:4.6.0"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.squareup:otto:1.3.8'
    implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
    implementation 'org.apache.commons:commons-lang3:3.9'
    implementation 'commons-io:commons-io:2.6'
    implementation 'com.koushikdutta.ion:ion:2.2.1'
    implementation 'com.google.code.gson:gson:2.8.6' 
    implementation 'com.google.dagger:dagger:2.25.4'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.25.4'
    annotationProcessor 'com.google.auto.value:auto-value:1.7'

}

and this updated project.gragle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'me.tatarka:gradle-retrolambda:3.7.0'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

repositories {
    mavenLocal()
    mavenCentral()
}

I tried a lot of code from stack but did not successed please how to resolve issue, please


Solution

  • I just added below line in app gradle now it's working here is full discussion.

      annotationProcessor "org.androidannotations:otto:4.6.0"