LoginSignup
1
1

More than 3 years have passed since last update.

Flutter エラー: Incompatible protocol version の解決策

Posted at

 事象とエラー内容:

Flutterで、あるアプリを開発途中、以下のようにエラーがでてしまい、デバッグができなくなる。シミュレータも実機も起動中のまま。。。

Error内容:

Terminal
 ... ...
Incompatible protocol version: client=3.26 vm=4.0
Failed to connect to the VM observatory service at: ws://127.0.0.1:63551/DPoP_jtt5ps=/ws
java.io.IOException: Incompatible protocol version: client=3.26 vm=4.0

因みに、Flutterは最新版に更新した9月11日時点で
Flutterの最新バージョンの問題ようなので、とりあえず、channelをmasterかstableに切替て試し
てみた。

 解決手順:

1) flutterのChannelを安定版に切り替エル

Terminal
$ flutter channel stable
Switching to flutter channel 'stable'...
git: Switched to a new branch 'stable'
git: Branch 'stable' set up to track remote branch 'stable' from 'origin'.
Successfully switched to flutter channel 'stable'.
To ensure that you're on the latest build from this channel, run 'flutter upgrade'

2) 因みにローカルに落としてくれなかったようなので、もう一度実行

Terminal
$ flutter channel stable
Downloading Dart SDK from Flutter engine d1bc06f032f9d6c148ea6b96b48261d6f545004f...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  247M  100  247M    0     0  27.4M      0  0:00:09  0:00:09 --:--:-- 30.1M
Building flutter tool...

  ╔════════════════════════════════════════════════════════════════════════════╗
  ║                 Welcome to Flutter! - https://flutter.dev                  ║
  ║                                                                            ║
  ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
  ║ statistics and basic crash reports. This data is used to help improve      ║
  ║ Flutter tools over time.                                                   ║
  ║                                                                            ║
  ║ Flutter tool analytics are not sent on the very first run. To disable      ║
  ║ reporting, type 'flutter config --no-analytics'. To display the current    ║
  ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out    ║
  ║ event will be sent, and then no further information will be sent by the    ║
  ║ Flutter tool.                                                              ║
  ║                                                                            ║
  ║ By downloading the Flutter SDK, you agree to the Google Terms of Service.  ║
  ║ Note: The Google Privacy Policy describes how data is handled in this      ║
  ║ service.                                                                   ║
  ║                                                                            ║
  ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and  ║
  ║ crash reports to Google.                                                   ║
  ║                                                                            ║
  ║ Read about data we send with crash reports:                                ║
  ║ https://flutter.dev/docs/reference/crash-reporting                         ║
  ║                                                                            ║
  ║ See Google's privacy policy:                                               ║
  ║ https://policies.google.com/privacy                                        ║
  ╚════════════════════════════════════════════════════════════════════════════╝


Downloading Material fonts...                                       1.5s
Downloading package sky_engine...                                   0.4s
Downloading flutter_patched_sdk tools...                            1.8s
Downloading flutter_patched_sdk_product tools...                    2.0s
Downloading darwin-x64 tools...                                     3.9s
Downloading libimobiledevice...                                     0.1s
Downloading usbmuxd...                                              0.2s
Downloading ios-deploy...                                           0.4s
Downloading darwin-x64/font-subset tools...                         0.6s
Switching to flutter channel 'stable'...
git: Already on 'stable'
git: Your branch is up to date with 'origin/stable'.
Successfully switched to flutter channel 'stable'.
To ensure that you're on the latest build from this channel, run 'flutter upgrade'

3) 問題なさそうなので、更新 flutter upgrade --force コマンドで更新をかける

Terminal
$ flutter upgrade --force
Flutter is already up to date on channel stable
Flutter 1.20.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 216dee60c0 (9 days ago) • 2020-09-01 12:24:47 -0700
Engine • revision d1bc06f032
Tools • Dart 2.9.2

4) アップグレード結果を確認する

Terminal
$ flutter doctor -v
[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.4 19E2265, locale ja-JP)
    • Flutter version 1.20.3 at /Users/kenkou/Documents/flutter
    • Framework revision 216dee60c0 (9 days ago), 2020-09-01 12:24:47 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/kenkou/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (1 available)
    • iPhone SE (2nd generation) (mobile) • 364B44C7-43D4-4B85-941E-ECFD31A058DC • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-5
      (simulator)

• No issues found!

5) ポイント: 若し、このままビルドかけると以下のエラーが出るので、 必ずFlutter Clean してから、ビルドかけ直すのも忘れずに

Terminal
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

Could not build the application for the simulator.

これで、エラーが消されました!

iOS、Androidアプリの制作なら、https://origon.co.jp にお任せください、
信頼且つ満足できる製品を納品いたします

ネーティブのみでのアプリ開発から、Flutterでのクロース開発への切替、どんどん面白くなりますし、アプリのロンチーも凄くスピードアップされる気がします。

1
1
1

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