In my case, I tried everything mentioned here. But then went to the SDK manager and installed all the platforms and tools. Restarted and issue got resolved.