0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android Studioで実機にインストールするときに遭遇したInitializing ADB...というフリーズの解消法

Posted at

フリーズ

3年ぶりくらいにAndroid Studioを使って、アプリを実機にインストールしようとして、Runボタンを押したら、Initializing ADB...という画面でずっとフリーズしたままになった。

スクリーンショット 2019-02-26 19.01.39.png

一向にデバイスが認識されないためいろいろ検索してみたところ、adbコマンドが機能していないのでは?という記事がたくさん出てきたので確認してみた。

adb
zsh: command not found: adb

パスが通っていないのか。。。

export PATH=$PATH:/Users/<user_name>/Library/Android/sdk/platform-tools

パスを通した後に以下のコマンドで復旧できるらしい。。。

adb kill-server
adb start-server

しかしデバイスは認識されずに**Initializing ADB...**のまま。。。

引き続き調べてみるとStack Overflowにイカした投稿を発見。
/etc/hostsを以下のように編集すれば良いそうだ

/etc/hosts
vim /etc/hosts

---
127.0.0.1       localhost

追加してみたら無事に端末が認識された。なぜ解消されたかは実は今だに不明だが、
adbのコマンドリファレンスをみてみると、**Java TM Debug Wire Protocol (JDWP)**というJava 仮想マシン (VM) との間の通信に使用されるプロトコルがlocalhostを使うようで、違うIPアドレスがlocalhostとして設定されていたりするとダメなのだろう。Android Studioは主戦場ではないので、あまり深追いしないでおく。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?