android-apt插件与Android Gradle插件不兼容。请使用' annotationProcessor'而是配置

时间:2017-10-28 07:14:45

标签: android android-gradle

根据this answerthis answer,我已经在app gradle中进行了更改,但在构建我的应用程序时,它仍然显示出错误。

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

我在这里缺少什么?

这是我的 App Gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'



//project.ext.versionInfo.releaseVersionName = SYNCED_VERSION_NAME

android {
    compileSdkVersion 23
    flavorDimensions "default"
    defaultConfig {
        applicationId "in.something"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 13
        versionName "1.10"
       multiDexEnabled true

       }
    productFlavors {
        LIVE_BETA {
            applicationIdSuffix ".beta"
            resValue "string", "app_display_name", "Something(B)"
            resValue "string", "SERVER_URL", "http://something/beta"

        }

        LIVE {
            resValue "string", "app_display_name", "something"
            resValue "string", "SERVER_URL", "http://something/live"

        }

        DEV {
            applicationIdSuffix ".dev"
            resValue "string", "app_display_name", "something(D)"
            resValue "string", "SERVER_URL", "http://localhost/"
        }
    }
    buildTypes {
        debug {
//            applicationIdSuffix "
// .debug"
//            versionNameSuffix "-debug"
        }

        release {
            //minifyEnabled true
            //shrinkResources true
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }
    // Rename APK files
//    applicationVariants.all { variant ->
//        def output = variant.outputs.get(0)
//        File apk = output.outputFile
//        String newName = output.outputFile.name.replace(".apk", "-${variant.mergedFlavor.versionCode}-${variant.mergedFlavor.versionName}-.apk")
//                .replace("app-", "${variant.mergedFlavor.applicationId}-")
//        output.outputFile = new File(apk.parentFile, newName)
//    }
}


repositories {
    jcenter()
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
}



dependencies {
    //================== Local ========================/
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //compile files('libs/ksoap2-android-assembly-3.1.1-jar-with-dependencies.jar')
    /** *************************************************/
    //================== Default ========================/
    implementation 'com.android.support:appcompat-v7:23.1.0'
    implementation 'com.android.support:recyclerview-v7:23.1.0'
    implementation 'com.android.support:design:23.1.0'
    implementation 'com.android.support:cardview-v7:23.1.0'
    /** *************************************************/
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.6.3'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.6.3'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.6.3'
    //implementation files('libs/bouncycastle-java5-136-1.0.0.jar')
    implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'

    /************  Location *****************/
    implementation 'com.google.android.gms:play-services-location:8.3.0'

    /** *************************************************/
    /************  Common *****************/
    implementation 'commons-io:commons-io:2.4'
    implementation 'commons-codec:commons-codec:1.4'
    /** ********************************/
    implementation('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
    implementation files('libs/bouncycastle-java5-136-1.0.0.jar')

}

我使用的是Android Studio 3.0,gradle版本是3.0

2 个答案:

答案 0 :(得分:4)

并在

下方添加
classpath 'io.fabric.tools:gradle:1.+'

定义

 classpath "io.realm:realm-gradle-plugin:4.1.1"

答案 1 :(得分:1)

对我而言,它似乎是从

升级Realm
classpath "io.realm:realm-gradle-plugin:1.0.0"

classpath "io.realm:realm-gradle-plugin:4.1.1"