Lots of Errors in Code but Still App Runs in Android Studio

Today, I opened a very old project for a quick update. After upgrading the support libraries, gradle plugins and other tools, I saw this strange issue for the first time. The app was building and running successfully, but when I opened any code file, I was getting huge list of compile errors mostly about Unresolved Reference etc.

Errors in Android Studio

Initially, I cleaned project, rebuild it, restarted Android studio few times, but couldn’t fix it. Heck, I even resumed my coding by ignoring these silly errors, but due to these strange errors, the autocomplete and other IDE functionalities were not working. So, I had to fix this problem. Then I googled it and found some answers on StackOverflow at here and here.

Most, suggestions were already same what I was doing. What fixed my issue was to delete the .idea and .gradle project from the app directory and Invalidate and Cache Restart the Android Studio and you will be back in the game.

If you liked this article, you can read my new articles below:

Wajahat Karim is Pakistan’s first Google Developer Expert in Android. As an experience Android developer, he deeply cares about it and keeps writing and speaking about it. He has written two worldwide 300+ pages books on Android development with more than 100 articles around the internet either on his website or his Medium publications. He is also a passionate contributor in open source and has created many Android libraries used by thousands of developers in their apps worldwide. As active public speaker, he spends lots of time giving talks in conferences and motivating people on Android development. You can find Wajahat most active on Twitter @WajahatKarim where he regularly shares all the good stuff about Android and community building.

Author's picture

Wajahat Karim

🔥 Google Dev Expert (GDE) in Android .
📱 Android Dev. 💻 Open Source Contributor . 📝 Technical Writer . 🎤 Public Speaker

Senior Android Developer

Karachi, Pakistan