LoginSignup
35
17

More than 3 years have passed since last update.

ReactNative-EXPOでAndroidエミュレータでアプリ起動するまでにはまったところ

Last updated at Posted at 2019-01-05

目次

  • はじめに
  • 本題
    • 「AVD Manager」がメニューにない問題
    • Intel x86 Emulator Accelerator(HAXM)がないと怒られる
    • This computer is not authorized to debug the device. Please follow the instructions here to enable USB debugging ぺらぺら
  • 締め

はじめに

自己紹介

 アゲてくハムスター

記事について

 過度な期待はしないでください

環境

  • lenovo x260 win10
  • React-naitive + expo

状況

とあるアプリをexpo clientをインストールしたi phone(実機)にて動作確認しながら開発中。
ある程度、完成したため、androidでの動作確認を実施する為、エミュレータで動かすことに。

「AVD Manager」がメニューにない問題

(ハマった時間:30min)

エミュレータを使用するとなった場合、まず、android Studioで「AVD Manager」を起動する必要があります。
下画像の様に、メニューバーの「Tools」->「Android」->「AVD Manager」から
起動できると、色んなサイトで書かれていたので、私もメニューを開いたら、

SnapCrab_NoName_2019-1-13_23-5-46_No-00.jpg

「AVD Manager」がない!!!
落ち着こう、ここにある

SnapCrab_NoName_2019-1-13_23-11-23_No-00.jpg

無事、開きました!

SnapCrab_NoName_2019-1-13_23-12-1_No-00.jpg

こんなことにも、30minとか使ってしまうこともある。

Intel x86 Emulator Accelerator(HAXM)がないと怒られる

(ハマった時間:300min)

さて、起動する仮想端末イメージも作成完了!!
エミュレータ起動だ!

SnapCrab_NoName_2019-1-14_0-10-32_No-00.jpg

起動しないぞ!

よくよくみると、エラーメッセージもでている。。
「Intel x86 Emulator Accelerator(HAXM)がないぞ!」的な英文。

[SDK Manager]→[Android SDK]にて
Intel x86 Emulator Accelerator(HAXM)を確認すると、
installedの文字。

なんでや。。。
念のため、アンインストールし、個別に再インストールする。

変わらず。。。

色々と調べてみると、どうやら、「Intel x86 Emulator Accelerator(HAXM)」は
「virtualization technology」という技術を基盤として動作するみたい。

BIOSを開き、下記画像の様に、「virtualization technology」を「Enabled」に変更する

SnapCrab_NoName_2019-1-13_23-44-14_No-00.jpg

エラーメッセージが消えて、
エミュレータが起動できるようになる!!

SnapCrab_NoName_2019-1-13_23-52-55_No-00.jpg

This computer is not authorized to debug the device. Please follow the instructions here to enable USB debugging

(ハマった時間:240min)

いよいよ、エミュレータも起動できたので、React-native+expoで開発中のアプリを
エミュレータ上で、動作させてみよう!
となった。。。

Android Studio起動

エミュレータ起動

ターミナル:Expo start

Run on Android device/emulator

エラー発生!!!!
(もうやめたげて、、、)

SnapCrab_NoName_2019-1-5_18-16-54_No-00.jpg

SnapCrab_NoName_2019-1-5_18-21-31_No-00.jpg

エラーメッセージ
Couldn't start project on Android: Error running adb:
This computer is not authorized to debug the device. Please follow the instructions here to enable USB debugging:
https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK directory.

対応

結論からいうと、下記URLの説明のとおりに、設定することで、エラーは解消する。

上のサイトの説明を読んだ後の率直な感想。。。
ん、この設定どこですんの?

実はこれ、エミュレータで動いている仮想android端末に対して、
設定をすることが正解でした。

[メニュー]→「Setting(設定)」を開こう
SnapCrab_NoName_2019-1-13_23-58-26_No-00.jpg

[buildNumber]を7回タップ→なんかでた。
SnapCrab_NoName_2019-1-14_0-1-39_No-00.jpg

開発者オプションを利用可能にし、USBデバッグオプションを有効にできました!

再度、expo 上で、Run on Android device/emulator

SnapCrab_NoName_2019-1-5_18-26-56_No-00.jpg

無事、エミュレーターで開発中のアプリを起動できました(8888)

締め

もし、この記事が、参考になった人は、フォロー&いいね!
どうぞよろしくお願いいたします!

35
17
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
35
17