Friday, November 3, 2017

Accepting the Android SDK License via Android Studio

If you want to debug using an Android emulator as I did for a Cordova project using Visual Studio code, you'll need to go through a series of steps to install the Android SDK (documented here). Once you revisit Visual Studio code and attempt to debug using "Run Android on Emulator," you might run into the following error:
You have not accepted the license agreements of the following SDK components: [Android SDK Platform 26].
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.

There are a slew of ways to solve this problem via the command line documented on this SO post here. However, I also found it easy to open up Android Studio and create a new basic project to trigger the license agreements. Once I created a project, the following licensing dialog was presented that I needed to agree to:


It also prompted me to download additional needed dependencies:


After I did the steps above, I was able to go back to Visual Studio Code and run my Cordova application using the Android emulator.

4 comments:

  1. This didn't work for me unfortunately

    ReplyDelete
  2. This did not work for me, but, after I closed and reopened the original project I was trying to build, the error message in Android Studio now contained a link to install the missing package, which, when clicked, brought up a license dialog.

    ReplyDelete
  3. unfortunately didnt work for me

    ReplyDelete
  4. I like the style of your solution. I used to do this on Linux installations. I now have a windows installation and need my brain rewiring to cope with the damaged method as implemented there.

    ReplyDelete