错误:android-apt 插件与 Android Gradle 插件不兼容。请改用'annotationProcessor'配置,问题?



我遇到了错误:android-apt 插件与 Android Gradle 插件不兼容的问题。 请使用"注释处理器"配置,我使用的是Android Studio 3.0.1,并且使用了一个可能已有2或3年历史的Android Studio项目,我已经尝试了所有方法,但找不到解决方案。虽然已经搜索了整个网络,但仍然没有运气解决它,而且我在 build.gradle 中的代码上没有看到任何 android-apt 插件

Build.Gradle 代码

    apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
    compileSdkVersion 24
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.app.baryalitob"
        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'
    }
    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'
您应该

从构建级别 gradle 中删除应用插件:"com.neenbedankt.android-apt">,或者如果问题仍然存在,请尝试删除一些第三方库。

我在macOS 3.1上使用Android Studio 10.13时遇到了同样的问题。

我尝试在两个文件中修改 gradle 版本:

1. gradle-wrapper.properties

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip

2. build.gradle(Module: app)

classpath 'com.android.tools.build:gradle:3.1.0'

classpath 'com.android.tools.build:gradle:2.1.2'

然后我解决了这个问题。

最新更新