LoginSignup
3
2

More than 5 years have passed since last update.

React NativeのAndroid エミュレータでFirebaseに接続ができなかったので、解決してみた

Last updated at Posted at 2018-04-07

起きていること

iOSでは何も問題なくFirebase接続できるのに、Androidでやろうとしたら一向に上手くいかない。
以下、emulator上のエラーメッセージ
A network error (such as timeout, interrupted connection or unreachable host) has occurred.

原因

Androidエミュレータがそもそもネットワーク接続できていなかったこと。
Android SDK 2.3で発生する問題のよう。

なんじゃそれ。デフォルトで繋がらないとか論外でしょ。

解決策

ネットワークの専門家じゃないので詳細は分からないが、
とりあえず現在繋いでいるLANやWifiのDNSを変更すればいいらしい。

こちらの記事の下方の方の回答を以下に転記する。

For me I just change the DNS address of my network to 8.8.8.8 and worked:

Open "System Preferences"
Click on "Network"
Select the network which your computer is connected and click on "Advanced"
Select "DNS", Select the "+" button, type "8.8.8.8"
Select "Ok" and "Apply"
After that close the emulator and start it again.

これで接続が出来るようになった。

編集後記

Xcodeが優れているのか、Android Studioがクソなのかわからないが、現状とにかくAndroidの方が色々と煩雑で面倒くさい。

3
2
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
3
2