firebase - 无法通过 `CompileOptions.compilerArgs` 指定 -processorpath 或 --processor-path。改用 `CompileOptions.annotationProcessorPath` 属性
问题描述
我正在从 GitHub 克隆一个 android 课程项目,并面临一系列错误,我已经设法解决了其中一些,直到我卡在最后一个,场景如下:
1- 错误:找不到 com.android.support:appcompat-v7:25.1.0。(解决了)。
2- 错误:模块根文件夹中缺少文件 google-services.json。没有它,Google 服务插件将无法运行。(已解决)
3 错误:无法通过 指定 -processorpath 或 --processor-path CompileOptions.compilerArgs
。改为使用该CompileOptions.annotationProcessorPath
属性。
这个我无法修复的错误截图
在添加了这个实现之后( implementation 'com.google.firebase:firebase-core:17.4.3'),我也得到了这个错误。
- 错误:此项目使用 AndroidX 依赖项,但未启用“android.useAndroidX”属性。在 gradle.properties 文件中将此属性设置为 true 并重试。 错误截图
解决方案
我发现该链接可以准确修复问题中提到的错误。
无法通过 `CompileOptions.compilerArgs` 指定 -processorpath 或 --processor-path
解决方案。
Delete “apply plugin: ‘android-apt’” line from your app module build.gradle file.
(Not necessary to work) Delete “classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.2’” from your top-level build.gradle file.
In “dependencies” section in build.gradle rename
apt ‘net.simonvt.schematic:schematic-compiler:0.6.3’
to
annotationProcessor ‘net.simonvt.schematic:schematic-compiler:0.6.3’
I’m using newest 26.0.2 buildToolsVersion as well as newest support libraries and everything works like a charm.
Remember to use newest gradle (4.1-all for now) and gradle plugin (3.0.0 for now). Add google repository to download newest support libraries. Sync and rebuild project. Now when you go to your manifest file, there should be no more red android:name=".provider.generated.SquawkProvider"
My top-level build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath ‘com.android.tools.build:gradle:3.0.0’
// Google Services plugin
classpath 'com.google.gms:google-services:3.1.1'
// 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
}
让我知道它是否有效。
推荐阅读
- gooddata - Gooddata 报告按商店显示天气
- spring-boot - 如何识别客户端是否意外终止对我的 SpringBoot API 的调用(在能够返回响应之前)
- php - 删除特定类 domdocument
- git - 在 ubuntu 上安装 gitlab 后如何发出提交
- python - Pandas 使用自定义体积加权聚合进行重采样
- spring-integration - Spring Integration dsl - HTTP 入站网关使用 multipart/form-data
- c# - C# MVVM 如何将命令添加到 TextBlock
- ruby - 尝试使用 wget 或 curl 下载文件时如何避免重定向?
- android - 如何从android的json中的url获取响应,而不是在响应之后我想解析它
- android - 使用multiply `exclude`时如何修复`POM file is invalid`?