LoginSignup
7
3

More than 3 years have passed since last update.

【AndroidStudio】ERROR: Failed to install the following Android SDK packages as some licences have not been accepted.

Last updated at Posted at 2019-11-21

Windows10にAndroidStudio(3.5.2)をインストール。
gitからプロジェクトをclone。
Make Projectしたら以下のエラー。

ERROR: Failed to install the following Android SDK packages as some licences have not been accepted.
   platforms;android-27 Android SDK Platform 27
   build-tools;28.0.3 Android SDK Build-Tools 28.0.3
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

Using Android SDK: C:\Users\ORE\AppData\Local\Android\Sdk
Install missing SDK package(s)

検索したらQiitaの記事を見つけた。

cd ~/Library/Android/sdk/tools/bin
./sdkmanager --licenses

が、そもそもパスが違う(Windowsだから)。。

sdkmanagerを探して実行

C:\Users\ORE\AppData\Local\Android\Sdk\tools\bin>"C:\Program Files (x86)\Android\android-sdk\tools\bin\sdkmanager.bat" --licenses

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

javaがない。。
そういえばjava単体では入れてない。

Android Studio入れた時に一緒に入ったjavaのパスで実行

C:\Users\ORE\AppData\Local\Android\Sdk\tools\bin>cd C:\Program Files\Android\Android Studio\jre\bin
C:\Program Files\Android\Android Studio\jre\bin>"C:\Program Files (x86)\Android\android-sdk\tools\bin\sdkmanager.bat" --licenses
(いい感じの出力、略)

正常に行ったっぽいのにAndroid StudioでMake Projectしたらエラー消えず。
よく見たらsdkmanagerが違うパスにもあった。

自分のホームの下、つまりは先の記事のWindows版ということか。

C:\Users\ORE\AppData\Local\Android\Sdk\tools\bin>cd "C:\Program Files\Android\Android Studio\jre\bin"
C:\Program Files\Android\Android Studio\jre\bin>C:\Users\ORE\AppData\Local\Android\Sdk\tools\bin\sdkmanager.bat --licenses
(いい感じの出力、略)

できた。
Make Projectも通って一件落着。

7
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3