Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error dart:html not found #56829

Closed
Ma7moud-2003 opened this issue May 10, 2020 · 5 comments
Closed

Error dart:html not found #56829

Ma7moud-2003 opened this issue May 10, 2020 · 5 comments

Comments

@Ma7moud-2003
Copy link

Ma7moud-2003 commented May 10, 2020

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
D/FlutterView( 7320): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@6809f18
D/FlutterView( 7320): Already attached to this engine. Doing nothing.

Compiler message:
lib/pages/login.dart:9:8: Error: Not found: 'dart:html'
import "dart:html";
       ^
../../../../../../Pictures/flutter/packages/flutter/lib/src/painting/_network_image_web.dart:64:12: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
    return ui.webOnlyInstantiateImageCodecFromUrl(resolved); // ignore: undefined_function
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslata
ble-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.dar
t: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:///C:/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
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\Mahmoud\Pictures\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\Mahmoud\Pictures\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 28s
Finished with error: Gradle task assembleDebug failed with exit code 1
@ja2375
Copy link

ja2375 commented May 10, 2020

You seem to be trying to run a web only application on an Android emulator.

Of course this is not going to work as the dart:html library is not available on Android. It is only available on web (as it makes sense).

If you really want to run the app on Android, start by removing any reference to the dart:html library.

@VladyslavBondarenko
Copy link

Thanks @ja2375 ,
@Ma7moud-2003 avoid any web dependencies in Android project,
related to #53005.
Closing, as this isn't an issue with Flutter,
if you disagree please write in the comments and I will reopen it

@deakjahn
Copy link

deakjahn commented May 15, 2020

It is a problem with Flutter. If you start to make a previously mobile-only application also run on the Web (moving to beta and adding web code), it can no longer be compiled for mobile. Definitely a bug, and a serious one at that. Basically, the application ceases to be cross platform, it becomes web-only.

You might consider it not a bug though but a very serious limitation but it isn't documented at all. The only realistic way to do cross platform development including Web is to move all your previous
platform code to a federated plugin. Not just any plugin but a federated one. Not an external plugin, no need to host it, just one internal to your app. In some edge cases you might get away with conditional imports but mostly and realistically, not.

That won't fare very well with the majority of app developers, I'm afraid, especially, that it isn't communicated up front.

@VladyslavBondarenko
Copy link

@deakjahn follow up on #39998

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants