Problems to generate apk

Good evening
I already updated the version of android, ionic, cordova and nodejs
When performing the command ionic cordova platform add android works correctly.
however when performing the command ionic cordova build android the following error occurs:
Warning: License for package with an exception
A problem occurred configuring root project android
You have not accepted the license agreements of the following SDK components: Android SDK Platform 26
Error: Command failed with an exception
Alternatively to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
Can anyone get a solution?
Thanks

Accept the licence agreement as it says in the error message.