Android Studio highlighting code red with no errors (Gradle 4.0.0 error)

Viewed 745

EDIT 2:

The problem is being caused by this dependency in my gradle:

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

This should not be happening, because it is a necessary dependency.

EDIT:

I now know why this is happening, but still don't know a fix. When I set my gradle build tools to 3.6.2 I get no errors, however upgrading to 4.0.0 gives me these errors.

ORIGINAL:

I don't know how this happened, but a few days ago this was not an issue and now it just won't go away. Android studio highlighted a bunch of lines red, with no error suggestions when I go to "show context actions", and everything is working perfectly fine (App is running with 0 errors; building the project has 0 compile errors; etc). The red highlights seem to be related to Activity based commands.

Everything I have tried:

  1. clean and rebuild project
  2. invalidate caches and restart
  3. delete the .idea and .gradle files and then resync project

These error highlights aren't causing any errors, but are really annoying.

enter image description here

enter image description here

enter image description here

2 Answers

I had a similar problem in the past. Just try to re-import the project.

  1. File -> Close project
  2. Delete project in list
  3. "Import project (Gradle, Eclipse, ADT, etc.)"

If you have done the rebuild, clean to your project then try it: Close the android studio and again open it. If might work.

Related