LoginSignup
4
5

More than 5 years have passed since last update.

AndroidStudio1.0の初回起動時に起動できない時の対処方法(The following SDK components were not installed)

Posted at

問題

Windows用AndroidStudio1.0(SDK同梱版)をインストールした直後の初回起動時、以下のエラーメッセージダイアログが表示されてしまってAndroidStudioが起動できない現象に遭遇しました。

Android SDK was installed to C:\hoge\hoge\sdk\
Refresh Sources:
  Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: Unknown Host dl-ssl.google.com
  Fetched Add-ons List successfully
  Refresh Sources
  Failed to fetch URL http://dl-ssl.google.com/android/repository/repository-10.xml, reason: IO Unknown Host dl-ssl.google.com
Refresh Sources:
  Failed to fetch URL http://dl-ssl.google.com/android/repository/repository-10.xml, reason: IO Unknown Host dl-ssl.google.com
There is nothing to install or update.
The following SDK components were not installed: platform-tools, extra-android-m2repository, tools, addon-google_apis-google-21, build-tools-21.1.1, android-21, sys-img-x86-addon-google_apis-google-21, source-21, extra-google-m2repository

エラーメッセージを見ると、SDKのコンポーネントが足りないようです。しかし「extra」や「addon」がインストールされていないだけなら理解できますが、SDK同梱版をインストールしたのにも関わらず「platform-tools」すらインストールされていないというメッセージが表示されてしまっています。

対処法

エラーメッセージから、正しいSDKディレクトリが参照できていないと推測しました。インストールの時にSDKの配置場所をデフォルトから変更したせいでしょうか?そこで色々と試した結果、私は以下の2つの対処法を考えました。

方法1 : android-sdkの中身を移動させる

インストール時に指定したSDKの配置場所に新たなディレクトリ(\android-sdk)が作成され、その中にSDKコンポーネントが配置されています。

この \android-sdk の中のファイルを全て、インストール時に指定したディレクトリ(ひとつ上の階層のディレクトリ)へ移動させます。

これでAndroidStudioを起動させると、無事に起動するはずです。

方法2 : 初回起動の時にスキャンする場所を変更する

AndroidStudioは初回起動時、以下のファイルを参照してSDKを探しにいっているようでした。

C:\Users\(ユーザー名)\.android\studio\installer\firstrun.data

ファイルの中身はこんな感じ

firstrun.data
# This file's encoding is UTF-16LE. If modified, preserve the encoding!

# Location of the user's JDK
jdk.dir=C:\Program Files\Java\jdk1.7.0_71

# Location of the user's Android SDK
androidsdk.dir=C:\hoge\hoge\sdk

# Location of a reference Android SDK that just has the latest files
androidsdk.repo=C:\hoge\hoge\sdk

# If true, create a default AVD with optimized settings
create.avd=true

# The UTC timestamp when this installer ran
install.timestamp=2014-12-11 01:18:29

このファイルのandroidsdk.dirandroidsdk.repoに記述されているパスがインストール時に指定したSDKを配置するディレクトリになっています。ここにそれぞれ \android-sdkを追記します。
追記した状態のファイルが以下です。

firstrun.data
# This file's encoding is UTF-16LE. If modified, preserve the encoding!

# Location of the user's JDK
jdk.dir=C:\Program Files\Java\jdk1.7.0_71

# Location of the user's Android SDK
androidsdk.dir=C:\hoge\hoge\sdk\android-sdk

# Location of a reference Android SDK that just has the latest files
androidsdk.repo=C:\hoge\hoge\sdk\android-sdk

# If true, create a default AVD with optimized settings
create.avd=true

# The UTC timestamp when this installer ran
install.timestamp=2014-12-11 01:18:29

AndroidStudioを起動させると、無事に起動します。


発生する環境や設定等の条件はいまいちわかりませんが、何かのお役にたてば。

4
5
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
4
5