flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.98k stars 319 forks source link

Analysis shows errors but there are none, hot reload fails #4762

Closed crtl closed 3 years ago

crtl commented 4 years ago

Since today the my analyser in AndroidStudio started showing: "Hot reload failed. Analysis issues".

Clicking "View Issues" shows no issues, only hints. If I build the app it builds and it also works on hot restart but not hot reload.

Steps to Reproduce

Dont know

Version info

[√] Flutter (Channel master, 1.21.0-7.0.pre, on Microsoft Windows [Version 10.0.18363.1016], locale en-DE)
    • Flutter version 1.21.0-7.0.pre at D:\dev\flutter\sdk
    • Framework revision 7ec2d360bc (3 weeks ago), 2020-07-29 23:25:38 -0700
    • Engine revision a9910e409c
    • Dart version 2.10.0 (build 2.10.0-1.0.dev 24c7666def)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\Marvin\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
jacob314 commented 4 years ago

To help us repro, what hints did you see? If you fix the hints, does hot reload work properly? It could also be useful to click the refresh button in the analysis server window to make sure the output there isn't stale for some reason.

crtl commented 4 years ago

The only hint shown is the one above the Analysis tab. "Analysis issues. Hot reload failed". There is no issue anywhere in the code editing window and also no issue shown in the linter results.

stevemessick commented 4 years ago

Does this still happen after doing flutter upgrade?

no-response[bot] commented 4 years ago

Without additional information we're unfortunately not sure how to resolve this issue. We're going to close this bug for now, but please don't hesitate to comment on the bug if you have any more information for us; we're happy to reopen. Thanks for your contribution!

crtl commented 4 years ago

@stevemessick I have upgrade flutter multiple times in the lifetime of this bug and switched branches.

Sry I have not many details because there is no reliable method to reproduce it. Thats an issue for itself. Where can I find logs of dart analysis or any information? Are there even any?

stevemessick commented 3 years ago

Where can I find logs of dart analysis or any information? Are there even any?

As @alexander-doroshko wrote: To get logs: open Registry (searchable using Find Action(Cmd+Shift+A)), and add the following to the dart.server.additional.arguments property:

--instrumentation-log-file=/some/path/das.log After that, restart the Analysis Server (a button with red errors in the Dart Analysis tool window), reproduce the issue, and attach das.log file here.

no-response[bot] commented 3 years ago

Without additional information we're unfortunately not sure how to resolve this issue. We're going to close this bug for now, but please don't hesitate to comment on the bug if you have any more information for us; we're happy to reopen. Thanks for your contribution!

Guang1234567 commented 3 years ago

@stevemessick

Analysis Server DiagnosticsDiagnostics Feedback Docs Spec 500 Oops NoSuchMethodError: The getter 'path' was called on null. Receiver: null Tried calling: path

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)

1 ContextsPage.generateContent (package:analysis_server/src/status/diagnostics.dart:486:71)

2 DiagnosticPageWithNav.generateContainer. (package:analysis_server/src/status/diagnostics.dart:736:13)

3 DiagnosticPageWithNav.generateContainer. (package:analysis_server/src/status/diagnostics.dart:734:20)

4 Page.asyncDiv (package:analysis_server/src/status/pages.dart:41:15)

5 DiagnosticPageWithNav.generateContainer (package:analysis_server/src/status/diagnostics.dart:734:11)

6 DiagnosticPage.generatePage (package:analysis_server/src/status/diagnostics.dart:690:11)

7 Page.generate (package:analysis_server/src/status/pages.dart:63:12)

8 Site.handleGetRequest (package:analysis_server/src/status/pages.dart:165:37)

9 HttpAnalysisServer._handleGetRequest (package:analysis_server/src/server/http_server.dart:88:23)

10 HttpAnalysisServer._handleServer. (package:analysis_server/src/server/http_server.dart:96:15)

11 HttpAnalysisServer._handleServer. (package:analysis_server/src/server/http_server.dart:93:23)

12 _rootRunUnary (dart:async/zone.dart:1362:47)

13 _CustomZone.runUnary (dart:async/zone.dart:1265:19)

14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)

15 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)

16 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)

17 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)

18 _StreamController._add (dart:async/stream_controller.dart:607:7)

19 _StreamController.add (dart:async/stream_controller.dart:554:5)

20 _HttpServer._handleRequest (dart:_http/http_impl.dart:2998:19)

21 new _HttpConnection. (dart:_http/http_impl.dart:2753:19)

22 _rootRunUnary (dart:async/zone.dart:1362:47)

23 _CustomZone.runUnary (dart:async/zone.dart:1265:19)

24 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)

25 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)

26 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)

27 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)

28 _StreamController._add (dart:async/stream_controller.dart:607:7)

29 _StreamController.add (dart:async/stream_controller.dart:554:5)

30 _HttpParser._headersEnd (dart:_http/http_parser.dart:394:19)

31 _HttpParser._doParse (dart:_http/http_parser.dart:745:15)

32 _HttpParser._parse (dart:_http/http_parser.dart:324:7)

33 _HttpParser._onData (dart:_http/http_parser.dart:858:5)

34 _rootRunUnary (dart:async/zone.dart:1362:47)

35 _CustomZone.runUnary (dart:async/zone.dart:1265:19)

36 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)

37 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)

38 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)

39 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)

40 _StreamController._add (dart:async/stream_controller.dart:607:7)

41 _StreamController.add (dart:async/stream_controller.dart:554:5)

42 _Socket._onData (dart:io-patch/socket_patch.dart:2144:41)

43 _rootRunUnary (dart:async/zone.dart:1370:13)

44 _CustomZone.runUnary (dart:async/zone.dart:1265:19)

45 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)

46 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)

47 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)

48 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)

49 _StreamController._add (dart:async/stream_controller.dart:607:7)

50 _StreamController.add (dart:async/stream_controller.dart:554:5)

51 new _RawSocket. (dart:io-patch/socket_patch.dart:1680:33)

52 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1192:14)

53 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)

54 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)

55 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:120:13)

56 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:185:5)

Guang1234567 commented 3 years ago
Guang1234567 commented 3 years ago

In my case,

ABC?  test_Dart_Analysis_Fail_That_Cause_Hot_Reload_Fail_Case_001 (List<ABC?>? items) {
      return item?[0];
}

Above code example will fail to hot reload, because the dart analyer has bug !!!

vixez commented 3 years ago

I also have this bug. For example I have this ListView

    return ListView.builder(
      itemCount: ratings!.length,
      shrinkWrap: true,
      primary: false,
      itemBuilder: (context, index) {
        return RatingRow(
          text: state.getLabelForDriverRating(ratings?[index]),
          rating: ratings?[index].rating,
        );
      },
    );

Because of ratings?[index] hot reload does not work, even though it is not showing any errors in the Dart Analysis tab. Force unwrapping fixes the hot reload ratings![index].

alexander-doroshko commented 3 years ago

This will be fixed in the next Dart plugin update.

fzyzcjy commented 3 years ago

I also see this bug. It happens on my >10k lines of flutter code, so I cannot make a reproducible sample.

@alexander-doroshko Thanks sounds wonderful! I wonder when will the next update be released? Before the update, what workaround can I do?

EDIT: I have even uninstall and reinstalled the plugin, but still cannot use hot reload :(

alexander-doroshko commented 3 years ago

The problem related to the foo?[bar] syntax has been fixed and the fix is included in the latest Dart plugin versions.

There might be other problems with hot reload, they should be investigated separately. Please attach the file that fails to be hot-reloaded and provide the versions of the Dart and Flutter plugins.

Guang1234567 commented 3 years ago

@alexander-doroshko

thanks. work well in android 4.2 and newest flutter plugin.

errdeka05 commented 3 years ago

I have the same bug with dart version 2.13.4 ....

Zarainia commented 3 years ago

I also have this issue, specifically in some files in my project. However, pressing save on other files in the same project works...

Quijx commented 2 years ago

I am having this issue too. What I found to be the cause is a parameter, which is annotated, required and has type. So for example the following code will cause this bug to happen for me:

void foo({@Deprecated('foo') required int foo}) {
  print('hi');
}
alexander-doroshko commented 2 years ago

@Quijx Thanks, filed as https://youtrack.jetbrains.com/issue/WEB-55630, will fix shortly.