android-studio - Android Studio 高亮代码红色且没有错误(Gradle 4.0.0 错误)

标签 android-studio gradle

编辑 2:

问题是由我的 gradle 中的这种依赖性引起的:

implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

这不应该发生,因为这是必要的依赖。

编辑:

我现在知道为什么会这样,但仍然不知道解决方法。当我将我的 gradle 构建工具设置为 3.6.2 时,我没有收到任何错误,但是升级到 4.0.0 会出现这些错误。

原创:

我不知道这是怎么发生的,但几天前这不是问题,现在它不会消失。 Android Studio 突出显示了一堆红色的行,当我转到“显示上下文操作”时没有错误建议,并且一切都工作得很好(应用程序运行时出现 0 个错误;构建项目有 0 个编译错误;等)。红色突出显示似乎与基于事件的命令有关。

我尝试过的一切:

  1. 清理并重建项目
  2. 使缓存失效并重启
  3. 删除 .idea 和 .gradle 文件,然后重新同步项目

这些错误突出显示不会导致任何错误,但确实很烦人。

enter image description here

enter image description here

enter image description here

最佳答案

我以前遇到过类似的问题。只需尝试重新导入该项目即可。

  1. 文件 -> 关闭项目
  2. 删除列表中的项目
  3. “导入项目(Gradle、Eclipse、ADT等)”

关于android-studio - Android Studio 高亮代码红色且没有错误(Gradle 4.0.0 错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62803855/

相关文章:

Android Studio 卡在启动模拟器

android - 升级到Android Studio 2.0 Preview 5后的“ZipException duplicate entry”

android - Gradle dependencies compile, apk project, compile project,provided,implementation project的区别

android - Android Gradle同步失败

gradle - gradle如何避免从人工制品中提取最新版本

android-studio - Android studio 模拟器错误显示屏幕

android - Google Play 计费 API : How to understand the user is subscribed?

android - Gradle无法找到依赖项

gradle - 遇到 gradle 构建问题

android - 没有这样的属性 : variantConfiguration for class: