Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager code example
Example 1: android studio licenses
yes | sdkmanager --licenses
sdkmanager --licenses
Example 2: 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