Java 无法通过`CompileOptions.compilerArgs指定-processorpath或--processor路径`
我正在尝试将我的应用程序与firebase消息服务链接,firebase消息服务使用以下警告编译:Java 无法通过`CompileOptions.compilerArgs指定-processorpath或--processor路径`,java,android,firebase,gradle,messaging,Java,Android,Firebase,Gradle,Messaging,我正在尝试将我的应用程序与firebase消息服务链接,firebase消息服务使用以下警告编译: *Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`. Use the `CompileOptions.annotationProcessorPath` property instead.* **My app gradle content is:**
*Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`. Use the `CompileOptions.annotationProcessorPath` property instead.*
**My app 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
}
信息:API“variant.getJavaCompile()”已过时,并已替换为“variant.getJavaCompileProvider()”。
它将于2019年底拆除。
有关详细信息,请参阅。
要确定调用variant.getJavaCompile()的内容,请在命令行上使用-Pandroid.debug.obsoleteApi=true以显示更多信息。
受影响模块:应用程序
当我运行时,会出现以下错误:
*Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`. Use the `CompileOptions.annotationProcessorPath` property instead.*
**My app 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
}
我的项目分级内容是:
*Cannot specify -processorpath or --processor-path via `CompileOptions.compilerArgs`. Use the `CompileOptions.annotationProcessorPath` property instead.*
**My app 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-删除下面的行,删除android apt插件:
apply plugin: 'android-apt'
2-将apt更改为实施
所以apt'net.simonvt.schematic:schematic编译器:0.6.3'
变成实现'net.simonvt.schematic:schematic编译器:0.6.3'
执行上述两个步骤后,应用程序崩溃:
原因:java.lang.ClassNotFoundException:未找到类“android.example.com.myProject.provider.generated…”provider“
3-我通过在app gradle文件中添加此代码修复了此错误:
android {
.........
..........
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
.....
....
}