Both VSCode and Intellij Idea cannot use debug mode, cannot be hot loaded, and debug mode will display a blank screen.
I run the following command in the terminal, it is no longer a blank screen, but it is not in debug mode, it can't be hot loaded, and in some cases did not compile the latest code
flutter run -v --debug
I try:
But, still can't work
I sent the logs ([ "--record-to", "bugreport", "--verbose", "--trace-startup"], debug-output and doctor output) to [email protected].
doctor output:
[✓] Flutter (Channel master, v0.9.7-pre.46, on Mac OS X 10.14 18A391, locale en-CN)
• Flutter version 0.9.7-pre.46 at /usr/local/flutter
• Framework revision 2d3ff10d62 (7 hours ago), 2018-10-05 07:54:56 +0200
• Engine revision 90b1023c84
• Dart version 2.1.0-dev.6.0.flutter-c6254163dc
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at /Users/xxx/Workspace/android/sdk/
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.2
• ANDROID_HOME = /Users/xxx/Workspace/android/sdk/
• Java binary at: /usr/local/java/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.0, Build version 10A255
• ios-deploy 2.0.0
• CocoaPods version 1.5.3
[✗] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[✓] IntelliJ IDEA Ultimate Edition (version 2018.2.4)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 29.0.4
• Dart plugin version 182.4505.50
[!] VS Code (version 1.27.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)
• SM G9350 • d3c73e90 • android-arm64 • Android 8.0.0 (API 26)
! Doctor found issues in 2 categories.
I see a lot of the same issues, I hope my log can help.
Thanks - could you capture a log from Dart Code?
Run the Dart: Capture Logs command from the VS Code command palette, and untick everything except Flutter Run and Debugger (Observatory) - leave those two ticked. Then reproduce the issue and click Stop Logging, and then send me that log.
(FWIW, I think you need to use --start-paused or --observatory-port from the command line to add the debugger; but probably it won't help here - you'll get the same white screen unless you open the debugger and unpause, but the problem here may be that Dart Code is not doing that.. Things will clearer with the log).
Can you also confirm which version of the Dart plugin you have? Seems you don't have the Flutter one installed, so the version wasn't included in the doctor output.
Can you also confirm which version of the Dart plugin you have? Seems you don't have the Flutter one installed, so the version wasn't included in the
doctoroutput.
I am using: dart-code-2.19.0-beta.2.vsix, install the plugin via install from VSIX.
Thanks - could you capture a log from Dart Code?
Run the
Dart: Capture Logscommand from the VS Code command palette, and untick everything exceptFlutter RunandDebugger (Observatory)- leave those two ticked. Then reproduce the issue and clickStop Logging, and then send me that log.(FWIW, I think you need to use
--start-pausedor--observatory-portfrom the command line to add the debugger; but probably it won't help here - you'll get the same white screen unless you open the debugger and unpause, but the problem here may be that Dart Code is not doing that.. Things will clearer with the log).
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 2.19.0
VS Code: 1.27.2
Platform: mac
Workspace type: Flutter
Multi-root?: false
Dart SDK:
Loc: /usr/local/flutter/bin/cache/dart-sdk
Ver: 2.1.0-edge.c6254163dc7a5f704d7609af65e4650ef0550ccd
Flutter SDK:
Loc: /usr/local/flutter
Ver: 0.9.7-pre.46
Fri Oct 05 2018 [21:12:17 GMT+0800 (CST)] Log file started
[21:12:18 GMT+0800 (CST)] [General] [Info] Starting debug session...
[21:12:18 GMT+0800 (CST)] [General] [Info] workspace: /Users/xxx/Workspace/flutter/demo
[21:12:18 GMT+0800 (CST)] [General] [Info] Using found common entry point: null
[21:12:18 GMT+0800 (CST)] [General] [Info] Using workspace as cwd: /Users/xxx/Workspace/flutter/demo
[21:12:18 GMT+0800 (CST)] [General] [Info] Detected launch project as Flutter
[21:12:18 GMT+0800 (CST)] [General] [Info] Using Flutter debug adapter for this session
[21:12:18 GMT+0800 (CST)] [General] [Info] Debug session starting...
{
"name": "Flutter",
"request": "launch",
"type": "dart",
"args": [],
"program": "/Users/xxx/Workspace/flutter/demo/lib/main.dart",
"cwd": "/Users/xxx/Workspace/flutter/demo",
"vmAdditionalArgs": [],
"dartPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/dart",
"maxLogLineLength": 2000,
"pubPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/pub",
"pubSnapshotPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot",
"debugSdkLibraries": false,
"debugExternalLibraries": false,
"evaluateGettersInDebugViews": true,
"flutterTrackWidgetCreation": false,
"flutterMode": "debug",
"flutterPath": "/usr/local/flutter/bin/flutter",
"deviceId": "d3c73e90",
"showMemoryUsage": false,
"debugServer": 51180
}
[21:12:18 GMT+0800 (CST)] [FlutterRun] [Info] Spawning /usr/local/flutter/bin/flutter with args ["run","--machine","-t","lib/main.dart","-d","d3c73e90","--start-paused"]
[21:12:18 GMT+0800 (CST)] [FlutterRun] [Info] .. in /Users/xxx/Workspace/flutter/demo
[21:12:20 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"daemon.connected","params":{"version":"0.4.2","pid":45789}}]
[21:12:20 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.start","params":{"appId":"ac52b7e5-449c-49fc-a0d3-7628c4678fd2","deviceId":"d3c73e90","directory":"/Users/xxx/Workspace/flutter/demo","supportsRestart":true}}]
[21:12:21 GMT+0800 (CST)] [FlutterRun] [Info] <== Launching lib/main.dart on SM G9350 in debug mode...
[21:12:21 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"ac52b7e5-449c-49fc-a0d3-7628c4678fd2","id":"0","progressId":null,"message":"Initializing gradle..."}}]
[21:12:22 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"ac52b7e5-449c-49fc-a0d3-7628c4678fd2","id":"0","progressId":null,"finished":true}}]
[21:12:22 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"ac52b7e5-449c-49fc-a0d3-7628c4678fd2","id":"1","progressId":null,"message":"Resolving dependencies..."}}]
[21:12:23 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"ac52b7e5-449c-49fc-a0d3-7628c4678fd2","id":"1","progressId":null,"finished":true}}]
[21:12:24 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"ac52b7e5-449c-49fc-a0d3-7628c4678fd2","id":"2","progressId":null,"message":"Gradle task 'assembleDebug'..."}}]
[21:12:26 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"ac52b7e5-449c-49fc-a0d3-7628c4678fd2","id":"2","progressId":null,"finished":true}}]
[21:12:26 GMT+0800 (CST)] [FlutterRun] [Info] <== Built build/app/outputs/apk/debug/app-debug.apk.
Fri Oct 05 2018 [21:12:43 GMT+0800 (CST)] Log file ended
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 2.19.0
VS Code: 1.27.2
Platform: mac
Workspace type: Flutter
Multi-root?: false
Dart SDK:
Loc: /usr/local/flutter/bin/cache/dart-sdk
Ver: 2.1.0-edge.c6254163dc7a5f704d7609af65e4650ef0550ccd
Flutter SDK:
Loc: /usr/local/flutter
Ver: 0.9.7-pre.46
Fri Oct 05 2018 [21:14:30 GMT+0800 (CST)] Log file started
[21:14:32 GMT+0800 (CST)] [General] [Info] Starting debug session...
[21:14:32 GMT+0800 (CST)] [General] [Info] workspace: /Users/xxx/Workspace/flutter/demo
[21:14:32 GMT+0800 (CST)] [General] [Info] Using found common entry point: null
[21:14:32 GMT+0800 (CST)] [General] [Info] Using workspace as cwd: /Users/xxx/Workspace/flutter/demo
[21:14:32 GMT+0800 (CST)] [General] [Info] Detected launch project as Flutter
[21:14:32 GMT+0800 (CST)] [General] [Info] Using Flutter debug adapter for this session
[21:14:32 GMT+0800 (CST)] [General] [Info] Debug session starting...
{
"name": "Flutter",
"request": "launch",
"type": "dart",
"args": [],
"program": "/Users/xxx/Workspace/flutter/demo/lib/main.dart",
"cwd": "/Users/xxx/Workspace/flutter/demo",
"vmAdditionalArgs": [],
"dartPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/dart",
"maxLogLineLength": 2000,
"pubPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/pub",
"pubSnapshotPath": "/usr/local/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot",
"debugSdkLibraries": false,
"debugExternalLibraries": false,
"evaluateGettersInDebugViews": true,
"flutterTrackWidgetCreation": false,
"flutterMode": "debug",
"flutterPath": "/usr/local/flutter/bin/flutter",
"deviceId": "d3c73e90",
"showMemoryUsage": false,
"debugServer": 51180
}
[21:14:32 GMT+0800 (CST)] [FlutterRun] [Info] Spawning /usr/local/flutter/bin/flutter with args ["run","--machine","-t","lib/main.dart","-d","d3c73e90","--start-paused"]
[21:14:32 GMT+0800 (CST)] [FlutterRun] [Info] .. in /Users/xxx/Workspace/flutter/demo
[21:14:33 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"daemon.connected","params":{"version":"0.4.2","pid":47213}}]
[21:14:33 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.start","params":{"appId":"6bb5f2c7-d2c5-47e2-917f-f633758bc25d","deviceId":"d3c73e90","directory":"/Users/xxx/Workspace/flutter/demo","supportsRestart":true}}]
[21:14:34 GMT+0800 (CST)] [FlutterRun] [Info] <== Launching lib/main.dart on SM G9350 in debug mode...
[21:14:34 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"6bb5f2c7-d2c5-47e2-917f-f633758bc25d","id":"0","progressId":null,"message":"Initializing gradle..."}}]
[21:14:35 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"6bb5f2c7-d2c5-47e2-917f-f633758bc25d","id":"0","progressId":null,"finished":true}}]
[21:14:35 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"6bb5f2c7-d2c5-47e2-917f-f633758bc25d","id":"1","progressId":null,"message":"Resolving dependencies..."}}]
[21:14:37 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"6bb5f2c7-d2c5-47e2-917f-f633758bc25d","id":"1","progressId":null,"finished":true}}]
[21:14:37 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"6bb5f2c7-d2c5-47e2-917f-f633758bc25d","id":"2","progressId":null,"message":"Gradle task 'assembleDebug'..."}}]
[21:14:39 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.progress","params":{"appId":"6bb5f2c7-d2c5-47e2-917f-f633758bc25d","id":"2","progressId":null,"finished":true}}]
[21:14:39 GMT+0800 (CST)] [FlutterRun] [Info] <== Built build/app/outputs/apk/debug/app-debug.apk.
Fri Oct 05 2018 [21:15:07 GMT+0800 (CST)] Log file ended
Thanks - it looks like you stopped logging around 20 seconds and 40 seconds after the last output line. Could you try running it and leaving it for a few minutes to see whether there are any timeouts reported?
If not, then try creating a launch.json config (click the Cog on the Debug Sidebar) and add "args": [ "-v" ] to the launch config, then repeat to get another log (this will run Flutter in verbose mode from the editor).
Thanks - it looks like you stopped logging around 20 seconds and 40 seconds after the last output line. Could you try running it and leaving it for a few minutes to see whether there are any timeouts reported?
If not, then try creating a launch.json config (click the Cog on the Debug Sidebar) and add
"args": [ "-v" ]to the launch config, then repeat to get another log (this will run Flutter in verbose mode from the editor).
No timeout, this is a log of about 10 minutes:
Thanks for the info. This looks like Flutter is timing out trying to connect to the debugger on the device:
[22:09:18 GMT+0800 (CST)] [FlutterRun] [Info] <== [ ] Waiting for observatory port to be available...
[22:09:21 GMT+0800 (CST)] [FlutterRun] [Info] <== [+2568 ms] Observatory URL on device: http://127.0.0.1:60759/
[22:09:21 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +1 ms] executing: /Users/xxx/Workspace/android/sdk/platform-tools/adb -s d3c73e90 forward tcp:0 tcp:60759
[22:09:21 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +8 ms] 56939
[22:09:21 GMT+0800 (CST)] [FlutterRun] [Info] <== [ ] Forwarded host port 56939 to device port 60759 for Observatory
[22:09:21 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +4 ms] Connecting to service protocol: http://127.0.0.1:56939/
[22:09:53 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.log","params":{"appId":"ede9d3df-0fe9-4c50-9e06-44976abf5730","log":"timeout waiting for the application to start","error":true}}]
[22:09:53 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.started","params":{"appId":"ede9d3df-0fe9-4c50-9e06-44976abf5730"}}]
There's a related PR at https://github.com/flutter/flutter/pull/22504 that might improve things.
@eightpigs Please try pulling latest master and see if there's any difference. I've increased the timeout that was being hit to three minutes (however, there's a possibility that someone is totally broken here, and it's not able to connect at all).
Still not working:
...
[00:14:11 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +1 ms] executing: /Users/xxx/Workspace/android/sdk/platform-tools/adb -s d3c73e90 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez start-paused true com.example.demo/com.example.demo.MainActivity
[00:14:11 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +127 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.demo/.MainActivity (has extras) }
[00:14:11 GMT+0800 (CST)] [FlutterRun] [Info] <== [ ] Waiting for observatory port to be available...
[00:14:13 GMT+0800 (CST)] [FlutterRun] [Info] <== [+1726 ms] Observatory URL on device: http://127.0.0.1:33918/
[00:14:13 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +1 ms] executing: /Users/xxx/Workspace/android/sdk/platform-tools/adb -s d3c73e90 forward tcp:0 tcp:33918
[00:14:13 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +11 ms] 65008
[00:14:13 GMT+0800 (CST)] [FlutterRun] [Info] <== [ ] Forwarded host port 65008 to device port 33918 for Observatory
[00:14:13 GMT+0800 (CST)] [FlutterRun] [Info] <== [ +6 ms] Connecting to service protocol: http://127.0.0.1:65008/
[00:17:03 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.log","params":{"appId":"ba3dab95-7e79-4168-953e-669d961a595d","log":"timeout waiting for the application to start","error":true}}]
[00:17:03 GMT+0800 (CST)] [FlutterRun] [Info] <== [{"event":"app.started","params":{"appId":"ba3dab95-7e79-4168-953e-669d961a595d"}}]
Sat Oct 06 2018 [00:23:10 GMT+0800 (CST)] Log file ended
Had a feeling that might happen :(
Notice near the end of the log it has this?
Forwarded host port 65008 to device port 33918 for Observatory
Connecting to service protocol: http://127.0.0.1:65008/
The port numbers will change each time you run it, but can you try again and when it outputs that, try opening the url from the last line in your browser?
Also - do you have a network proxy?
Also - do you have a network proxy?
Yes, I am using a network proxy. I used to manually enable it before, but I always need to set it manually, so I put it in .zshrc the day before yesterday.
However, my network proxy excludes 127.0.0.1 (LAN), so I skipped it.
In short, I removed 'http_proxy & https_proxy' from .zshrc and it works fine.
Thank you very much for your answers, now I can coding...
I think if you put 127.0.0.1 in an env var called NO_PROXY then that might also fix it, without you needing to remove it globally. Try it out and let me know if it works.
it worked, need to restart vscode after setting.
Great! I might see if we can add a flutter doctor test for this with instructions on how to fix. Thanks!
Most helpful comment
Great! I might see if we can add a
flutter doctortest for this with instructions on how to fix. Thanks!