If you face the same error, here are the step by step instructions:
- Open control panel
- Then go to System
- Then go to Change Environment Variables of the User
- Then click create a new environment variables
- Create a new variable named ANDROID_SDK_HOME
- Set its value to your Android directory, like
C:/users/<username>/.android