Newbie trying to finish the My first App tutorial provided by Google. On the way to this fatal exception I did import a lot of random packages to get rid of \"cannot be reso
In my case the issue occurred in Android Studio 4.0. I suppose there was something wrong with Gradle cache.
Unfortunately, neither Invalidate Сaches / Restart
, nor Build -> Clean Project
& Build -> Rebuild Project
didn't help me, so I had to take drastic measures.
Close Android Studio.
Open Terminal and navigate to your project's root directory.
Delete all Gradle modules' build directories, so all modules will be recompiled soon.
find . -wholename "*/build" -exec rm -rf {} \;
But if you have a single module, then just:
rm -rf app/build
Purge Gradle cache. By default, it's located in your home directory.
rm -rf ~/.gradle
Open Android Studio again. It will start to build the project. It will take a long time, since we have just deleted the cache, but the issue should be resolved.