Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`

橙三吉。 提交于 2021-01-29 10:01:35

问题


I am trying to link my app with firebase messaging services it compiled with this warning:

INFO: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration-avoidance. To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information. Affected Modules: app

When I run the I get the following error:

*Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`. Use the                `CompileOptions.annotationProcessorPath` property instead.*


**My app gradle content is:**
apply plugin: 'com.android.application'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'


android {
    compileSdkVersion 29
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "android.example.com.squawker"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'androidx.appcompat:appcompat:1.0.0'
    testImplementation 'junit:junit:4.12'

    // RecyclerView
    implementation 'androidx.recyclerview:recyclerview:1.0.0'

    // Schematic dependencies for ContentProvider
    apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
    implementation 'net.simonvt.schematic:schematic:0.6.3'

    // Preferences Dependencies
    implementation 'androidx.preference:preference:1.0.0'

    implementation 'com.google.firebase:firebase-messaging:20.1.3'

}

My project gradle content is:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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


        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

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

回答1:


I solved my problem with following setps below:

1- Remove android-apt plugin by deleting the line below:

apply plugin: 'android-apt'

2- Change apt to implementation

So apt 'net.simonvt.schematic:schematic-compiler:0.6.3'

become implementation 'net.simonvt.schematic:schematic-compiler:0.6.3'

Then the app crashes after implementing the 2 steps above:

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.example.com.myProject.provider.generated........Provider"

3- I fixed this error with adding this code in app gradle file:

android {
.........
..........
defaultConfig {
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath true
            }
        }
}

.....
....
}


来源:https://stackoverflow.com/questions/60794604/cannot-specify-processorpath-or-processor-path-via-compileoptions-compilerar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!