I started working on a new app (min API: 24, target/compile: 27) yesterday and updated Android Studio to version 3.6 after creating the project. Now I keep running into the same problem over and over:
When I add a new UI item with an id or if I change an existing id, then access the e.g. R.id.activity1
in my code, there's no suggestion popup for the id. When I just type it out, the code turns red and it's marked as an error on the sidebar and in the class name. The app still builds and runs fine.
Contrary to this question not all of the R
occurances are marked though, only the ones that I changed/created since the last restart.
What I've tried:
- Build - Clean Project
- Build - Rebuild Project
- File - Sync Project with Gradle Files
Neither works. I have to restart Android Studio to get rid of the fake errors (no need to invalidate caches).
The gradle
file looks fine as far as I can see (appcompat
and design
are version 27.1.1) and there's only a single error in the xml files that is connected to the problem:
This project contains Java compilation errors, which can cause rendering failures for custom views. Fix compilation problems first.
How do I fix this, so I can actually create/edit ids without restarting Android Studio every time?