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?

Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)を解決した経緯

0
Posted at

状況

Android StudioのAVD を起動し、flutter run コマンドを実行した際に、ビルドは正常に完了し、生成されたAPKファイルがエミュレータにインストールされたが、MethodChanneが繋がらずにエラーが出た。

環境

  • Ubuntu 20.04.6 LTS
  • Visual Studio Code 1.109.2
  • Android StudioのAVDのMedium Phone

コマンド結果

flutter run --no-enable-impeller

E/flutter ( 9038): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)\

詳細

E/flutter ( 9038): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)

  • PlatformException():デバイスあるいはデバイスとの間の通信でのエラー
  • channel-error:MethodChanneでのエラー
  • Unable to establish connection on channel.:チャネル接続を確立できない
  • null:ネイティブ側から送られる詳細データ
  • null:ネイティブ側のスタックトレース

解決方法

  • 全てのpubspec.yamlのfirebase_coreを最新の4.4.0にした
  • pubspec.yamlのfirebase_core_platform_interfaceを削除した
  • 全てのpubspec.yamlのfirebase_authを最新の6.1.4にした
  • 全てのpubspec.yamlのfirebase_crashlyticsを最新の6.1.4にした
  • 全てのpubspec.yamlのfirebase_messagingを最新の16.1.1にした
  • 全てのpubspec.yamlのcloud_firestoreを最新の6.1.2にした
flutter clean
# 全ての変更したディレクトリ内で行う(子から親)
flutter pub get

感想

firebaseのバージョンによるエラーだったっぽいのでfirebase_coreを削除してあとは依存関係のエラーが出るパッケージを最新版にしていったら治った。

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?