简体   繁体   中英

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

apply plugin: 'com.android.application'

apply plugin: 'realm-android'

android { compileSdkVersion 24 buildToolsVersion '26.0.2'

defaultConfig {
    applicationId "com.kolhapur.news"
    minSdkVersion 14
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

/* IMPORTANT : * Be careful when update dependencies, different version library may caused error / dependencies { compile fileTree(dir: 'libs', include: [' .jar']) testCompile 'junit:junit:4.12' // google library compile 'com.android.support:appcompat-v7:24.1.1' compile 'com.android.support:cardview-v7:24.1.1' compile 'com.android.support:recyclerview-v7:24.1.1' compile 'com.android.support:design:24.1.1' compile 'com.android.support:support-v4:24.1.1' compile 'com.google.android.gms:play-services-ads:9.2.1' compile 'com.google.android.gms:play-services-analytics:9.2.1' compile 'com.google.firebase:firebase-messaging:9.2.1'

// library for api
compile('com.squareup.retrofit2:retrofit:2.0.0-beta4') {
    exclude module: 'okhttp'
}**strong text**
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'

// ripple effect library
compile 'com.balysv:material-ripple:1.0.2'

}

apply plugin: 'com.google.gms.google-services'

Remove these lines

apply plugin: 'com.google.gms.google-services'

And

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

This works with me.

From this answer Incompatible plugins for android-apt after upgrading to Android Studio 2.3

The android-apt plugin has been deprecated .
Check here for the migration guide :

As of the Android Gradle plugin version 2.2, all functionality that was previously provided by android-apt is now available in the Android plugin.

You can remove android-apt by following the migration guide to get the equivalent functionalities.

The important parts from the migration guide :

  • Make sure you are on the Android Gradle 2.2 plugin or newer.
  • Remove the android-apt plugin from your build scripts
  • Change all apt , androidTestApt and testApt dependencies to their new format:
dependencies {
   compile 'com.google.dagger:dagger:2.0'
   annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
}

Also in the Android Gradle plugin there is an explicit check for this, which is what you are seeing:

using incompatible plugins for the annotation processing android-apt

Future Android Gradle plugin versions will not be compatible with the way android-apt works, which is the reason for that check.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM