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
165.02k stars 27.19k forks source link

FrontendCompiler.compile > writeDepfile FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; > message=StandardFileSystem only supports file:* and data:* URIs) #52763

Closed i6x86 closed 4 years ago

i6x86 commented 4 years ago

First, excuse me about the crossposting, but in 24 hours the question was viewed 9 times on Stackoverflow and I suppose 3 of them are mine, from different devices. Here is the original post:

It's an app in production. I've changed some logic trying to obtain dateTime that I have localized changing it to another country, then suddenly there were some error saying something about dart html but I don't remember exactly what, so I tried to rebuild the project and it was complaining about using new build system and so far I tried:

changing the system to legacy flutter clean udate cocoapods. remove podfile.lock pod update pod install packages upgrade flutter upgrade None of theses did the work.

When changed to legacy there were like 13 errors one of them complaining that dart:html not found, so I've added it to dependencies and dev dev dependencies and still nothing. I also commented the intl package because I was using it when that happened and did packages get and nothing.

Any ideas how to deal with this?

Here is the full console Xcode's output:

>     2020-03-16 17:55:17.549 xcodebuild[56626:765857]  DTDeviceKit: deviceType from 3ad4f96e876e8222a72563420303530067367818 was NULL
>     ** BUILD FAILED **
> 
> 
> Xcode's output: ↳

  **Skipped Warnings about deprecated methods, because of char limits and previously builds despite the warnings.** 

> 
>     Compiler message:
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:11:8:
> Error: Not found: 'dart:html'
>     import 'dart:html';
>            ^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:6:8:
> Error: Not found: 'dart:html'
>     import 'dart:html';
>            ^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:10:
> Error: Type 'HttpRequest' not found.
>       Future<HttpRequest> _getString(String url, HttpRequest xhr) {
>              ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:46:
> Error: Type 'HttpRequest' not found.
>       Future<HttpRequest> _getString(String url, HttpRequest xhr) {
>                                                  ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:34:18:
> Error: 'HttpRequest' isn't a type.
>       final _xhrs = <HttpRequest>{};
>                      ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:20:23:
> Error: Method not found: 'HttpRequest'.
>         var request = new HttpRequest();
>                           ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:46:
> Error: 'HttpRequest' isn't a type.
>       Future<HttpRequest> _getString(String url, HttpRequest xhr) {
>                                                  ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:29:35:
> Error: 'HttpRequest' isn't a type.
>         var completer = new Completer<HttpRequest>();
>                                       ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:58:34:
> Error: 'Blob' isn't a type.
>           var blob = xhr.response as Blob ?? Blob([]);
>                                      ^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:46:15:
> Error: The method 'HttpRequest' isn't defined for the class
> 'BrowserClient'.
>      - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart').
>     Try correcting the name to the name of an existing method, or defining a method named 'HttpRequest'.
>         var xhr = HttpRequest();
>                   ^^^^^^^^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:58:42:
> Error: The method 'Blob' isn't defined for the class 'BrowserClient'.
>      - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart').
>     Try correcting the name to the name of an existing method, or defining a method named 'Blob'.
>           var blob = xhr.response as Blob ?? Blob([]);
>                                              ^^^^
>     ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:59:20:
> Error: The method 'FileReader' isn't defined for the class
> 'BrowserClient'.
>      - 'BrowserClient' is from 'package:http/src/browser_client.dart' ('../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart').
>     Try correcting the name to the name of an existing method, or defining a method named 'FileReader'.
>           var reader = FileReader();
>                        ^^^^^^^^^^
>     Unhandled exception:
>     FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml;
> message=StandardFileSystem only supports file:* and data:* URIs)
>     #0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
>     #1      asFileUri (package:vm/kernel_front_end.dart:604:37)
>     #2      writeDepfile (package:vm/kernel_front_end.dart:799:21)
>     <asynchronous suspension>
>     #3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:472:15)
>     <asynchronous suspension>
>     #4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:38:22)
>     #5      starter (package:flutter_frontend_server/server.dart:149:27)
>     #6      main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
>     #7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
>     #8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
> 
>     Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
>     Failed to build bundle.
>     Failed to package /Users/[user]/StudioProjects/[projectName]/ios/...
>     Command PhaseScriptExecution failed with a nonzero exit code
>     note: Using new build system
>     note: Planning build
>     note: Constructing build description
> 
> Could not build the precompiled application for the device.
> 
> Error launching application on [user].

EDIT: I also have "platform :ios, '11.0'" in my Podfile and iOS Deployment Target set to 11.0 on Pods settings.

jonahwilliams commented 4 years ago

Are you importing browser_client.dart from package:http?

i6x86 commented 4 years ago

Are you importing browser_client.dart from package:http?

No, I don't.

i6x86 commented 4 years ago

Are you importing browser_client.dart from package:http?

But im using the http package, the latest version http: ^0.12.0+4

i6x86 commented 4 years ago

These are all the packages I use:

dependencies: flutter: sdk: flutter

flutter_localizations: sdk: flutter

flutter_cupertino_localizations: ^1.0.1

geoflutterfire: ^2.0.3+5

firebase_storage: ^3.0.6

cloud_firestore: ^0.12.9+6

firebase_core: ^0.4.0+9

firebase_auth: ^0.14.0+5

firebase_messaging: ^6.0.9

firebase_database: ^3.0.7

firebase_admob: ^0.9.0+7

flutter_facebook_login: ^3.0.0

font_awesome_flutter: ^8.5.0

image_picker: ^0.6.1+11

image: ^2.1.4

rxdart: ^0.22.1

location: ^2.3.5

google_maps_flutter: ^0.5.20+1

geocoder: ^0.2.1

google_sign_in: ^4.0.11

provider: ^4.0.4

flutter_inapp_purchase: ^2.0.4

http: ^0.12.0+4

url_launcher: ^5.2.5

intl: ^0.16.0

cloud_functions: ^0.4.1+4

apple_sign_in: ^0.1.0

flutter_signin_button: ^1.0.0

json_annotation: ^3.0.1

notification_permissions: ^0.4.4

html_unescape: ^1.0.1+3

cupertino_icons: ^0.1.2

dev_dependencies: flutter_test: sdk: flutter build_runner: ^1.7.3 json_serializable: ^3.2.5

Note: Like I said I've added the html package as well, but when I saw it doesn't work I removed it.

jmagman commented 4 years ago

This isn't really an Xcode issue tool, some of those errors are a dart compilation error related to a dart package (not plugin, so not CocoaPods), and the actual exception is:

>     Unhandled exception:
>     FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml;
> message=StandardFileSystem only supports file:* and data:* URIs)
>     #0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
>     #1      asFileUri (package:vm/kernel_front_end.dart:604:37)
>     #2      writeDepfile (package:vm/kernel_front_end.dart:799:21)
>     <asynchronous suspension>
>     #3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:472:15)
>     <asynchronous suspension>
>     #4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:38:22)
>     #5      starter (package:flutter_frontend_server/server.dart:149:27)
>     #6      main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
>     #7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
>     #8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
> 

which may be fixed by https://github.com/dart-lang/sdk/commit/d8462dd015f2dcd4397e0124c82ba1c934d3a569 (see https://github.com/dart-lang/sdk/issues/36481).

jmagman commented 4 years ago

What's the output of flutter doctor -v?

jonahwilliams commented 4 years ago

This error is caused by importing code that transitively depends on dart:html. It would be nice if, when the CFE fails to resolve this library, it could print an error that contained more information on where it was imported from. Something like main.dart -> package:foobar -> dart:htm.

fyi @mit-mit

i6x86 commented 4 years ago

First to add that just tested it on Android and there are the same errors:

Compiler message: ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:11:8: Error: Not found: 'dart:html' import 'dart:html'; ^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:6:8: Error: Not found: 'dart:html' import 'dart:html'; ^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:10: Error: Type 'HttpRequest' not found. Future _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:46: Error: Type 'HttpRequest' not found. Future _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:34:18: Error: 'HttpRequest' isn't a type. final _xhrs = {}; ^^^^^^^^^^^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:20:23: Error: Method not found: 'HttpRequest'. var request = new HttpRequest(); ^^^^^^^^^^^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:28:46: Error: 'HttpRequest' isn't a type. Future _getString(String url, HttpRequest xhr) { ^^^^^^^^^^^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.0/lib/src/http_request_data_reader.dart:29:35: Error: 'HttpRequest' isn't a type. var completer = new Completer(); ^^^^^^^^^^^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:58:34: Error: 'Blob' isn't a type. var blob = xhr.response as Blob ?? Blob([]); ^^^^ ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart:46:15: Error: The method 'HttpRequest' isn't defined for the class 'BrowserClient'.

Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.

i6x86 commented 4 years ago

What's the output of flutter doctor -v?

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale es-ES) • Flutter version 1.12.13+hotfix.8 at /Users/roc3n/Developer/flutter • Framework revision 0b8abb4724 (5 weeks ago), 2020-02-11 11:44:36 -0800 • Engine revision e1e6ced81d • Dart version 2.7.0

⣷Error 1 retrieving device properties for ro.product.cpu.abi: error: device '4df72f8220b7213f' not found

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0) • Android SDK at /Users/roc3n/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) • All Android licenses accepted.

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

[✓] Android Studio (version 3.6) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 44.0.2 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.42.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.8.1

[✓] Connected device (2 available) • GT I9300 • 4df72f8220bFdfsdfeEFdsfds72f • android-arm • Android null (API null) • i6x86 • 3ad4f96e876e822fddfe5543818 • ios • iOS 13.3.1

• No issues found!

jonahwilliams commented 4 years ago

@i6x86 to be clear this isn't a bug with the compiler besides the bad error message. Are you importing browser_client.dart in your code base? Because this is not supported when compiling for platforms other than web

i6x86 commented 4 years ago

@i6x86 to be clear this isn't a bug with the compiler besides the bad error message. Are you importing browser_client.dart in your code base? Because this is not supported when compiling for platforms other than web

No. But I have it like a part of the http package. I have no intention to build a web app.

i6x86 commented 4 years ago

I mean yes it's there, but it's not my intend to import it. It seems it's a part of this package: http: ^0.12.0+4

i6x86 commented 4 years ago

@jonahwilliams sorry, my bad, it seems this browser_client.dart is not part of the project. It's there in this path /Developer/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+4/lib/src/browser_client.dart and I have no idea how this can be part of the project. I did: flutter config --no-enable-web ... just in case I enabled the web somehow, then did flutter clean I also commented the http package un pubspec.yaml but these errors persists.

jonahwilliams commented 4 years ago

Can you provide a minimal sample project that reproduces the issue? If not I have to conclude that you are likely depending on code that is importing web only libraries.

i6x86 commented 4 years ago

I started new project and added the same packages and it is ok, so I can't provide a sample project. Following some comments on Stackoverflow I found there were an import of Intl/date_symbol_data_http_request.dart I wasn't using and after removing it I get this error "flutter dyld: Library not loaded: @rpath/AppAuth.framework/AppAuth" and now I'm trying to resolve this one, so I'm closing this one. Thanks!

lock[bot] commented 4 years 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.