【问题标题】:Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor'错误:android-apt 插件与 Android Gradle 插件不兼容。请使用“注释处理器”
【发布时间】:2018-08-07 06:47:20
【问题描述】:
apply plugin: 'com.android.application'

应用插件:'realm-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'
    }
}

}

/* 重要: * 更新依赖时要小心,不同的版本库可能会导致错误/ 依赖{ 编译 fileTree(dir: 'libs', include: ['.jar']) 测试编译'junit:junit:4.12' // 谷歌图书馆 编译'com.android.support:appcompat-v7:24.1.1' 编译'com.android.support:cardview-v7:24.1.1' 编译'com.android.support:recyclerview-v7:24.1.1' 编译'com.android.support:design:24.1.1' 编译'com.android.support:support-v4:24.1.1' 编译'com.google.android.gms:play-services-ads:9.2.1' 编译'com.google.android.gms:play-services-analytics:9.2.1' 编译 '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'

}

应用插件:'com.google.gms.google-services'

【问题讨论】:

    标签: android


    【解决方案1】:

    删除这些行

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

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

    这对我有用。

    【讨论】:

      【解决方案2】:

      来自这个答案Incompatible plugins for android-apt after upgrading to Android Studio 2.3

      android-apt 插件已被弃用
      在这里查看migration guide

      从 Android Gradle 插件版本 2.2 开始,之前由 android-apt 提供的所有功能现在都可以在 Android 插件中使用。

      您可以按照迁移指南删除android-apt 以获得等效功能。

      迁移指南中的重要部分:

      • 确保您使用的是 Android Gradle 2.2 插件或更高版本。
      • 从您的构建脚本中删除 android-apt 插件
      • 将所有 aptandroidTestApttestApt 依赖项更改为新格式:
      dependencies {
         compile 'com.google.dagger:dagger:2.0'
         annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
      }
      

      在 Android Gradle 插件中也有一个明确的检查,这就是你所看到的:

      使用不兼容的插件进行注解处理 android-apt

      未来的 Android Gradle 插件版本将不兼容android-apt 的工作方式,这就是检查的原因。

      【讨论】:

        猜你喜欢
        • 2020-01-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-11-25
        相关资源
        最近更新 更多