Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol for my packages

Similar problems

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 workspace 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?

EDIT

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.

left-old; right-new

like image 569
gkiko Avatar asked Feb 08 '15 14:02

gkiko


1 Answers

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.

like image 52
nana Avatar answered Oct 02 '22 22:10

nana