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

Compilation error #453

Closed
TyrusLabs opened this issue Aug 3, 2020 · 2 comments
Closed

Compilation error #453

TyrusLabs opened this issue Aug 3, 2020 · 2 comments
Labels
type-question A question about expected behavior or functionality

Comments

@TyrusLabs
Copy link

Tirumalas-MacBook-Pro:pustalk Tyrus$ flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split

Compiler message:
../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:6:8: Error: Not found: 'dart:html'
import 'dart:html';
^
../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:34:18: Error: 'HttpRequest' isn't a type.
final _xhrs = {};
^^^^^^^^^^^
../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart:58:34: Error: 'Blob' isn't a type.
var blob = xhr.response as Blob ?? Blob([]);
^^^^
../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/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' ('../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/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();
    ^^^^^^^^^^^
    ../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/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' ('../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/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([]);
    ^^^^
    ../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/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' ('../../development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/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)
    Remove dart:mirror usage from package:http #1 asFileUri (package:vm/kernel_front_end.dart:567:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:760:21) #3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:539:15) #4 _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:40:22) #5 starter (package:flutter_frontend_server/server.dart:178:27) #6 main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30) #7 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32) #8 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

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

FAILURE: Build failed with an exception.

  • Where:
    Script '/Users/Tyrus/audiopustak/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 882

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildRelease'.

Process 'command '/Users/Tyrus/audiopustak/development/flutter/bin/flutter'' 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 10s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 11.2s
Gradle task assembleRelease failed with exit code 1
Tirumalas-MacBook-Pro:pustalk Tyrus$

@TyrusLabs
Copy link
Author

Code was working fine and I had to reboot the laptop.

@natebosch
Copy link
Member

You cannot import package:http/browser_client.dart on platforms other than the web. Use the cross-platform package:http/http.dart instead.

@natebosch natebosch added the type-question A question about expected behavior or functionality label Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

2 participants