accept the SDK license agreements and install the missing components using the Android Studio SDK Manager code example
Example 1: To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
android update sdk --no-ui --all --filter platform-tools,android-25,extra-android-m2repository
sdkmanager --update
Example 2: accept the SDK license agreements and install the missing components using the Android Studio SDK Manager
check you SDK manager Run It AS Administrator (in windows) Update SDK tools in android studio