升级Gradle并删除了android-apt现在出现错误

时间:2019-05-16 18:16:40

标签: android apt dagger

所以当我遵循

的迁移规则时

错误:android-apt插件与Android Gradle插件不兼容。请改为使用“ annotationProcessor”配置。 受影响的模块:应用

警告:API'variantOutput.getProcessResources()'已过时,并已替换为'variantOutput.getProcessResourcesProvider()'。 它将在2019年底删除。 有关更多信息,请参见https://d.android.com/r/tools/task-configuration-avoidance。 要确定正在调用variantOutput.getProcessResources()的内容,请在命令行上使用-Pandroid.debug.obsoleteApi = true来显示更多信息。 受影响的模块:应用

我不确定我是否做的正确,但是我将向您展示一些代码。当我删除android-apt时,我会收到错误消息。

在类型为org.gradle.api.Project的项目':app'上找不到用于参数[build_cp842uh50fh4d8lqnmxsyyyzb $ _run_closure4 @ 27a00008]的方法apt()。

我尝试添加到依赖项中

编译'com.google.dagger:dagger:2.6' 注解处理器“ com.google.dagger:dagger-compiler:2.6”

仍然无效。

    repositories {
        mavenCentral()

        maven {
            url 'http://repo.spring.io/milestone'
        }
    }
    dependencies {
        // replace with the current version of the android-apt plugin
        //classpath 'com.neenbedankt.gradle.plugins:android-apt:1.6'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

repositories {
    mavenCentral()
    mavenLocal()
    jcenter()
}

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

def AAVersion = '3.3.2'

android {
    compileSdkVersion 27
    buildToolsVersion "28.0.3"

    defaultConfig {
        applicationId  "ca.elevatie.app"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:appcompat-v7:23.3.0'
    implementation 'com.google.firebase:firebase-core:11.0.4'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
    implementation "org.androidannotations:androidannotations:$AAVersion"
    implementation "org.androidannotations:androidannotations-api:$AAVersion"
}

apt {
    arguments {
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
        // if you have multiple outputs (when using splits), you may want to have other index than 0

        // you should set your package name here if you are using different application IDs
        // resourcePackageName "your.package.name"

        // You can set optional annotation processing options here, like these commented options:
        // logLevel 'INFO'
        // logFile '/var/log/aa.log'
    }
}

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

使用当前代码,它给我一个错误:

在类型为org.gradle.api.Project的项目':app'上找不到用于参数[build_cp842uh50fh4d8lqnmxsyyyzb $ _run_closure4 @ 27a00008]的方法apt()。

0 个答案:

没有答案
相关问题