Android使用不兼容的插件进行注释处理

时间:2017-04-05 06:35:08

标签: android

在对我的项目进行更多工作并安装ro后删除一些库。我得到这个错误:

Warning:Using incompatible plugins for the annotation processing: 
android-apt. This may result in an unexpected behavior.

我搜索有关此问题的更多网站,但我无法解决该问题

这是我的应用build.gradle内容文件

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

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "ir.pishguy.cafealachiqpro"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
}

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
    maven { url "https://clojars.org/repo/" }
}

def dbflow_version = "4.0.0-beta5"
def sqlcipher_version = "3.5.4"

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-v13:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'

    compile 'org.greenrobot:eventbus:3.0.0'

    compile('io.socket:socket.io-client:0.8.3') {
        exclude group: 'org.json', module: 'json'
    }
    compile 'com.bugsnag:bugsnag-android:+'
    compile 'com.facebook.rebound:rebound:0.3.8'
    compile 'com.tumblr:backboard:0.1.0'
    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'

    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.squareup.picasso:picasso:2.5.2'

    apt "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}"
    // use kapt for kotlin apt
    compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}"
    compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}"
    // sql-cipher database encryption (optional)
    compile "com.github.Raizlabs.DBFlow:dbflow-sqlcipher:${dbflow_version}"
    compile "net.zetetic:android-database-sqlcipher:${sqlcipher_version}@aar"

    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.0.1'
}

此内容适用于项目build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我得到的错误:我在LogCat

上得到了这个结果
Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior.
/Users/mahdi/Desktop/Home/Projects/Android/CafeAlachiqPro/app/src/main/java/ir/pishguy/cafealachiqpro/Ui/Register/Activity/View/ActivityRegister.java
Error:(48, 45) error: package ir.pishguy.cafealachiqpro.databinding does not exist
Error:(75, 13) error: cannot find symbol class ActivityRegisterBinding
/Users/mahdi/Desktop/Home/Projects/Android/CafeAlachiqPro/app/src/main/java/ir/pishguy/cafealachiqpro/Ui/Register/Robot/RobotMessagesAdapter.java
Error:(12, 45) error: package ir.pishguy.cafealachiqpro.databinding does not exist
Error:(13, 45) error: package ir.pishguy.cafealachiqpro.databinding does not exist
/Users/mahdi/Desktop/Home/Projects/Android/CafeAlachiqPro/app/src/main/java/ir/pishguy/cafealachiqpro/Ui/Register/Robot/RobotViewHolder.java
Error:(6, 45) error: package ir.pishguy.cafealachiqpro.databinding does not exist
Error:(13, 13) error: cannot find symbol class RobotDataBinding
Error:(15, 28) error: cannot find symbol class RobotDataBinding
/Users/mahdi/Desktop/Home/Projects/Android/CafeAlachiqPro/app/src/main/java/ir/pishguy/cafealachiqpro/Ui/Register/Robot/UserViewHolder.java
Error:(6, 45) error: package ir.pishguy.cafealachiqpro.databinding does not exist
Error:(13, 13) error: cannot find symbol class UserMessagesDataBinding
Error:(15, 27) error: cannot find symbol class UserMessagesDataBinding

所有绑定类都是正确的我通过点击每个绑定类

来检查它们

3 个答案:

答案 0 :(得分:1)

删除

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

apply plugin: 'android-apt'

并将apt依赖项更改为annotationProcessor,如:

apt 'com.contentful.vault:compiler:0.9.9'

annotationProcessor 'com.contentful.vault:compiler:0.9.9'

答案 1 :(得分:0)

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

您正在应用同一插件的两个不同版本。你应该只使用其中一个。哪一个?毫无头绪,取决于你为什么要添加第二个开头。

答案 2 :(得分:0)

Gradle 2.2版中包含一个注释处理器,因此没有理由提供额外的处理器。

检查我的更新回答here