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.

【Flutter】AndroidエミュレーターでWebViewがクラッシュしてしまう

Last updated at Posted at 2019-06-16

Flutterでアプリを開発している際に、AndroidエミュレーターでTwitterログインを実行しようとするとWebViewがクラッシュしてしまうバグに遭遇しました。
iOSエミュレーター側では問題なくTwitterログインしようとするとWebViewが立ち上がります。

Androidエミュレーター内のAndroidのバージョンは執筆時最新の9.0です。

エラー文

W/ActivityThread( 4818): handleWindowVisibility: no activity for token android.os.BinderProxy@f233a40
D/NetworkSecurityConfig( 4818): No Network Security Config specified, using platform default
I/WebViewFactory( 4818): Loading com.android.chrome version 66.0.3359.158 (code 336015817)
I/u.chatbotmobil( 4818): The ClassLoaderContext is a special shared library.
I/cr_LibraryLoader( 4818): Time to load native libraries: 11 ms (timestamps 248-259)
I/chromium( 4818): [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader( 4818): Expected native library version number "66.0.3359.158", actual native library version number "66.0.3359.158"
W/cr_ChildProcLH( 4818): Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
I/cr_BrowserStartup( 4818): Initializing chromium process, singleProcess=false
I/cr_base ( 4818): Android Locale: en_US requires .pak files: [en-GB.pak, en-US.pak]
E/chromium( 4818): [ERROR:devtools_http_handler.cc(292)] Cannot start http server for devtools. Stop devtools.
W/u.chatbotmobil( 4818): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;-><init>(Landroid/content/Context;I)V (light greylist, reflection)
W/u.chatbotmobil( 4818): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;)V (light greylist, reflection)
W/u.chatbotmobil( 4818): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionStarted(I)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
W/u.chatbotmobil( 4818): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(II)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
W/u.chatbotmobil( 4818): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
W/u.chatbotmobil( 4818): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextSelection;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
W/u.chatbotmobil( 4818): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(III)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
W/u.chatbotmobil( 4818): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
I/Choreographer( 4818): Skipped 77 frames!  The application may be doing too much work on its main thread.

handleWindowVisibility: no activity for token android.os. でぐぐってみてもそれらしいものは見つからず…
他で出てきたandroid Token retrieval failed: SERVICE_NOT_AVAILABLEというエラーでぐぐってももわからず…。

Cannot start http server for devtools. Stop devtools.という文があるのでChromeの問題?と思い立ち上げてみると、Androidのエミュレーターで、ネットに繋がりません。

ということでエミュレーター内のChromeブラウザに表示されている DNS_PROBE_FINISHED_BAD_CONFIG というエラー文でぐぐって調べました。

解決方法

Androidエミュレーターでネットにアクセス出来るようにDNSの設定をする!

MacOSXの場合は以下の手順で行います。

  1. System Preferencesを開く
  2. Networkをクリック
  3. 接続中のネットワークを選択し、右下のAdvancedをクリック
  4. DNSタブを選択し、左下の「+」ボタンを押下
  5. 「8.8.8.8」と入力し保存。
  6. Networkのページに戻ってきて、右下のApplyを押下
  7. エミュレーターを立ち上げ直す

WindowsとLinuxは以下のリンクを参考に
Get Started - Google PublicDNS

参考

Android emulator not able to access the internet - StackOverflow

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?