flutter / devtools

Performance tools for Flutter
https://flutter.dev/docs/development/tools/devtools/
BSD 3-Clause "New" or "Revised" License
1.58k stars 326 forks source link

In recent versions of devtools. Internet access is required to load and so use dev tools. #2420

Closed elansys-kc closed 3 years ago

elansys-kc commented 4 years ago

If you open devtools without being connected to the internet then devtools fails to load and the following message is shown in google chromes console.

unpkg.com/canvaskit-wasm@0.17.2/bin/canvaskit.js:1 Failed to load resource: net::ERR_INTERNET_DISCONNECTED

Opening this issue for tracking as requested by @yjbanov in the following issue: https://github.com/flutter/devtools/issues/2125

elansys-kc commented 3 years ago

This is also true of Android Studio. Without internet you get DevTools failed and even closing android studio and re-opening without internet access prevents use of dev tools, just like the browser.

elansys-kc commented 3 years ago

Installing devtools such as described here: devtools

Also still requires unpkg.com access in the browser and android studio still hangs with "installing devtools".

jacob314 commented 3 years ago

Fyi @helin24 to resolve the Android Studio issue. Seems like it is time for a more offline friendly solution to run devtools than pub global activate

dnfield commented 3 years ago

I think the problem here is that it needs some way to bundle the CanvasKit WASM blob witht he package rather than pulling it from a CDN.

This probably would require upstream changes in the web engine to accomodate. @yjbanov

dnfield commented 3 years ago

If you set FLUTTER_WEB_CANVASKIT_URL as a compiler define, you can override the URL of the wasm blob.

I think it'd work if you just included the blob as an asset and overrode that define to point t the asset URL.

dnfield commented 3 years ago

https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/canvaskit/initialization.dart#L51-L79

kevlar700 commented 3 years ago

It seems that devtools via android studio on the dev channel is still not useable offline, making testing navigation to a local server via ethernet quite tedious.

Is it just the four canvas kit files that are needed for a local unpkg.com mirror?

jacob314 commented 3 years ago

The canvas kit files are now usable offline. The problem is the Android Studio process to activate devtools. We are working to fix that issue and streamline how DevTools is deployed in general by bundling it with the Dart SDK.

kevlar700 commented 3 years ago

I still get the unpkg.com connection attempt failure in Google chrome.

I'm not sure why fonts.gstatic.com for Roboto is required either when I have my own fonts bundled? Mentions fallback cannot be retrieved, so I guess something needs fixing on my end for that.

jacob314 commented 3 years ago

Are you talking about your Flutter Web app or Dart DevTools?

kevlar700 commented 3 years ago

Good point, maybe the flutter for web app was switched to canvaskit in the dev ch from html because it broke about a week or so after the fix if I recall correctly