Android Studio inline compiler showing red errors, but compilation with gradle works fine Android Studio Marks syntax as error, but gradle compiles
My project broke after upgrading my Gradle version by editing build.gradle
and gradle-wrapper.properties
. However I can run it on virtual device without errors.
Neither Sync with Gradle files, Invalidate Caches nor rolling back to old commits solve the problem.
My workspace snapshot
Classes League
and Match
are in the same package but they can't see each other. Using classes with full path doesn't solve the issue, because my packages aren't visible e.g. Cannot resolve symbol 'model'
. Also rolling back to previous commits doesn't fix the problem.
Initially I wanted to make New Relic work which required new version of gradle. This caused bigger problem. Can you help me find the solution?
I think I figured it out. I created new project an copied only java source and xml res files from the old one and the red lines disappeared. Left screen is old project.
I had the same issue, and I still haven't figured out why it happened..
Anyways I resolved it by deleting the .idea
folder and rebuilding the project from build.gradle
.
Once you delete the .idea
folder and restart Android Studio it will tell you it found an un-linked Gradle project (if you miss this message popup you can find it in the EventLog in the bottom right section), follow the directions to join the projects and it will fix itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With