flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
164.82k stars 27.16k forks source link

Unable to retrieve framework response: Message is not valid JSON #148806

Closed arkryonia closed 3 months ago

arkryonia commented 3 months ago

Steps to reproduce

  1. flutter create
  2. Run the project without debug mode
  3. Check the Debug Console

Expected results

New project runs successfully .

Actual results

The project run with success but with a warning.

Code sample

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration RAS

Logs

Logs ```console Unable to retrieve framework response: Message is not valid JSON ════════ Exception caught by services library ══════════════════════════════════ The following assertion was thrown during a platform message callback: A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in `HardwareKeyboard`. This was the event: KeyDownEvent#9c8ae(physicalKey: PhysicalKeyboardKey#ed430(usbHidUsage: "0x000700e1", debugName: "Shift Left"), logicalKey: LogicalKeyboardKey#df100(keyId: "0x200000102", keyLabel: "Shift Left", debugName: "Shift Left"), character: null, timeStamp: 59:16:59.400000) 'package:flutter/src/services/hardware_keyboard.dart': Failed assertion: line 505 pos 16: '!_pressedKeys.containsKey(event.physicalKey)' ```

Flutter Doctor output

Doctor output ```console Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.22.0, on Debian GNU/Linux 12 (bookworm) 6.1.0-21-amd64, locale fr_FR.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio (version 2023.3) [✓] Connected device (2 available) [✓] Network resources • No issues found! ```
huycozy commented 3 months ago

Hi @arkryonia, this issue occurs on Linux app target, right? Do you press any key while launching the app?

github-actions[bot] commented 3 months ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

RomanCherkasov commented 3 months ago

Same here

[✓] Flutter (Channel stable, 3.22.2, on Archcraft 6.9.3-arch1-1, locale en_US.UTF-8)
    • Flutter version 3.22.2 on channel stable at /home/roman/Develop/SDK/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (7 days ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/roman/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_SDK_ROOT = /home/roman/Android/Sdk
    • Java binary at: /home/roman/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/google-chrome-stable

[✓] Linux toolchain - develop for Linux desktop
    • clang version 17.0.6
    • cmake version 3.29.5
    • ninja version 1.12.1
    • pkg-config version 2.1.1

[✓] Android Studio (version 2023.3)
    • Android Studio at /home/roman/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Archcraft 6.9.3-arch1-1
    • Chrome (web)    • chrome • web-javascript • Google Chrome 125.0.6422.141

[✓] Network resources
    • All expected network resources are available.

• No issues found!
RomanCherkasov commented 3 months ago

At first glance, everything works well, but for some reason this warning occurs. @huycozy Do I need to reopen issue?

github-actions[bot] commented 2 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.