3

I want to update my project to run in android studio 3.0. While updating I'm getting an error with apt. I changed my complete build.gradle means all compile to implementation. Here is my build.gradle file.

Here is my error:

Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.

Here is my build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'


android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.sample"
        minSdkVersion 19
        targetSdkVersion 26
        multiDexEnabled true
}
lintOptions {
    checkReleaseBuilds false
    abortOnError false
}
configurations{
    all*.exclude module: 'servlet-api'
}
dexOptions {
    javaMaxHeapSize "4g"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'

   }
   configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-annotations:26.0.2'
    }
}

}

dependencies {
implementation project(':androidHorizontalListView')
implementation project(':library')
implementation project(':simpl3r')



implementation  'com.google.code.gson:gson:2.2.4'
implementation  files('libs/acra-4.5.0.jar')
implementation  files('libs/bugsense-3.6.jar')
implementation  files('libs/espresso-1.1-bundled.jar')
implementation  files('libs/sample-2.4.1.jar')
implementation  files('libs/signpost-commonshttp4-1.2.1.1.jar')
implementation  files('libs/signpost-core-1.2.1.1.jar')
implementation  files('libs/twitter4j-core-4.0.2.jar')
implementation  files('libs/universal-image-loader-1.9.2-SNAPSHOT-with-sources.jar')
implementation  files('libs/volley.jar')
implementation  files('libs/YouTubeAndroidPlayerApi.jar')
implementation  files('libs/gcm.jar')
implementation  files('libs/mint-5.2.1.jar')
implementation project(':swipelibrary')


implementation  files('libs/glide-3.7.0.jar')
implementation  files('libs/glide-3.7.0-javadoc.jar')
implementation  'org.jsoup:jsoup:1.8.3'
implementation  'org.mozilla:rhino:1.7.7'
implementation  'info.guardianproject.netcipher:netcipher:1.2'
implementation  'com.nineoldandroids:library:2.4.0'
implementation  'com.thefinestartist:utils:0.9.1'
apt 'com.thefinestartist:compilers:0.9.1'
implementation  'com.android.support:recyclerview-v7:26.0.2'
implementation  'in.srain.cube:grid-view-with-header-footer:1.0.12'
implementation  'joda-time:joda-time:2.9.2'
implementation  'com.writingminds:FFmpegAndroid:0.3.2'

//implemented retrofit.
testImplementation 'junit:junit:4.12'


implementation  'com.android.support:appcompat-v7:26.0.2'
implementation  'com.squareup.retrofit:retrofit:1.9.0'

implementation  'com.google.android.gms:play-services-analytics:10.2.1'
implementation  'com.facebook.android:facebook-android-sdk:4.26.0'

implementation  'com.android.support:design:26.0.2'
implementation  'com.flurry.android:analytics:6.3.1'
implementation project(':sample-chat')


implementation  'com.quickblox:quickblox-android-sdk-core:3.1.0'
implementation  "com.google.android.gms:play-services-gcm:10.2.1"


implementation project(':sample-core')

}
Cœur
  • 37,241
  • 25
  • 195
  • 267
Lassie
  • 984
  • 11
  • 25
  • 1
    Possible duplicate of [Incompatible plugins for android-apt after upgrading to Android Studio 2.3](https://stackoverflow.com/questions/42574803/incompatible-plugins-for-android-apt-after-upgrading-to-android-studio-2-3) – jayeshsolanki93 Dec 13 '17 at 11:25

2 Answers2

0

You enable annotation processing via this answer, then you can delete the line

apply plugin: 'com.neenbedankt.android-apt'

and replace

apt 'com.thefinestartist:compilers:0.9.1'

with

annotationProcessor 'com.thefinestartist:compilers:0.9.1'

Josh Laird
  • 6,974
  • 7
  • 38
  • 69
  • if i change like that iam getting this errror............Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details – Lassie Dec 13 '17 at 11:31
  • Did you check the log? Try opening the Gradle console in the bottom right of Android Studio and read the red text. You may have to follow the stack trace to the first error that appears. There are other questions on StackOverflow that fix this problem such as this one: https://stackoverflow.com/questions/46988102/errorcom-android-tools-aapt2-aapt2exception-aapt2-error-check-logs-for-detail – Josh Laird Dec 13 '17 at 15:16
0

1) Remove below line from your project's build.gradle file:

apply plugin: 'com.neenbedankt.android-apt'

2) Replace : apt 'com.thefinestartist:compilers:0.9.1'

with

annotationProcessor 'com.thefinestartist:compilers:0.9.1'

3) Go to your gradle.properties write the below code and sync your project: android.enableAapt2=false

for resolving com.android.tools.aapt2.Aapt2Exception: AAPT2 error

Gaurav Singh
  • 2,200
  • 16
  • 30