Friday, April 6, 2018

When Android Studio can't resolve certain symbols or imports

Today I needed to start an Android Studio project from an existing template. When opening it, though, I saw that a handful of the imports had failed with "cannot resolve symbol." This Stack Overflow question has a few different solutions, none of which (and no combinations or repeats of which) worked for me. I eventually found - in a different Stack Overflow post - the idea of deleting/moving the .idea folder. This actually worked! The first time Android Studio opened the project after the move, it threw a bunch of errors, but then it managed to regenerate everything it needed. Since run configurations are stored in .idea\runConfigurations, I made sure to copy that folder over from the old .idea to the regenerated one. After that, things appear to be working as intended.

No comments:

Post a Comment