Flutter 颤振构建找不到';dart:html';
我试过运行Flutter 颤振构建找不到';dart:html';,flutter,dart,Flutter,Dart,我试过运行flatterclean。我尝试在beta和稳定频道之间切换。 编译器似乎试图添加一些东西来支持浏览器,但我正在编译一个APK。 颤振腹板支持已禁用。我以前在编译这本书时没有遇到任何问题。看起来问题的根源可能是我正在使用的sentry包 如何使应用程序重新编译 这是buildapk $ flutter build apk You are building a fat APK that includes binaries for android-arm, android-arm64, a
flatterclean
。我尝试在beta
和稳定
频道之间切换。
编译器似乎试图添加一些东西来支持浏览器,但我正在编译一个APK。
颤振腹板支持已禁用。我以前在编译这本书时没有遇到任何问题。看起来问题的根源可能是我正在使用的sentry
包
如何使应用程序重新编译
这是buildapk
$ 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:
../../flutter/.pub-cache/hosted/pub.dartlang.org/sentry-3.0.1/lib/src/browser.dart:7:8: Error: Not found: 'dart:html'
import 'dart:html' hide Event, Client;
^
../../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';
^
../../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 = <HttpRequest>{};
^^^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/sentry-3.0.1/lib/src/browser.dart:51:19: Error: Getter not found: 'window'.
origin ??= '${window.location.origin}/';
^^^^^^
../../flutter/packages/flutter/lib/src/painting/_network_image_web.dart:88:12: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
return ui.webOnlyInstantiateImageCodecFromUrl(resolved, // ignore: undefined_function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../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([]);
^^^^
../../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' ('../../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();
^^^^^^^^^^^
../../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' ('../../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([]);
^^^^
../../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' ('../../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)
#1 asFileUri (package:vm/kernel_front_end.dart:567:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:760:21)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:536:15)
<asynchronous suspension>
#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.<anonymous closure> (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 '/home/werner/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/home/werner/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 28s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 29.4s
Gradle task assembleRelease failed with exit code 1
$flatter构建apk
您正在构建一个包含android arm、android-arm64和android-x64二进制文件的胖APK。
如果要将应用程序部署到Play Store,建议使用应用程序捆绑包或拆分APK以减小APK大小。
要生成应用程序包,请运行:
颤振构建appbundle——目标平台安卓arm、安卓arm64、安卓x64
了解有关以下内容的详细信息:https://developer.android.com/guide/app-bundle
要按ABI拆分APK,请运行:
颤振构建apk——目标平台安卓arm、安卓arm64、安卓x64——按abi拆分
了解有关以下内容的详细信息:https://developer.android.com/studio/build/configure-apk-splits#configure-阿比斯普利特
编译器消息:
../../flatter/.pub cache/hosted/pub.dartlang.org/sentry-3.0.1/lib/src/browser.dart:7:8:错误:未找到:“dart:html”
导入“dart:html”隐藏事件,客户端;
^
../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser\u client.dart:6:8:错误:未找到:“dart:html”
导入“dart:html”;
^
../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser\u client.dart:34:18:错误:“HttpRequest”不是类型。
最终_xhrs={};
^^^^^^^^^^^
../../flatter/.pub cache/hosted/pub.dartlang.org/sentry-3.0.1/lib/src/browser.dart:51:19:错误:找不到Getter:“窗口”。
原点=“${window.location.origin}/”;
^^^^^^
../../flatter/packages/flatter/lib/src/painting/_network\u image\u web.dart:88:12:错误:找不到方法:“webonlyInstantiateImageCodeFromURL”。
返回ui.webonlyInstantiateImageCodeFromURL(已解析,//忽略:未定义的函数
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser\u client.dart:58:34:错误:“Blob”不是一种类型。
var blob=xhr.response为blob??blob([]);
^^^^
../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser\u client.dart:46:15:错误:未为类“BrowserClient”定义方法“HttpRequest”。
-“BrowserClient”来自“package:http/src/browser_client.dart”(“../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart”)。
尝试将名称更正为现有方法的名称,或定义名为“HttpRequest”的方法。
var xhr=HttpRequest();
^^^^^^^^^^^
../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser\u client.dart:58:42:错误:未为类“BrowserClient”定义方法“Blob”。
-“BrowserClient”来自“package:http/src/browser_client.dart”(“../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart”)。
尝试将名称更正为现有方法的名称,或定义名为“Blob”的方法。
var blob=xhr.response为blob??blob([]);
^^^^
../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser\u client.dart:59:20:错误:未为类“BrowserClient”定义方法“FileReader”。
-“BrowserClient”来自“package:http/src/browser_client.dart”(“../../flatter/.pub cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/browser_client.dart”)。
尝试将名称更正为现有方法的名称,或定义名为“FileReader”的方法。
var reader=FileReader();
^^^^^^^^^^
未处理的异常:
FileSystemException(uri=org-dartlang不可翻译uri:dart%3Ahtml;message=StandardFileSystem仅支持文件:*和数据:*uri)
#0 StandardFileSystem.entityForUri(包:前端/src/api\u原型/standard\u文件\u系统。dart:33:7)
#1 asFileUri(包:vm/kernel\u front\u end.dart:567:37)
#2写文件(包:vm/内核\前端。dart:760:21)
#3 FrontendCompiler.compile(包:frontend_server/frontend_server.dart:536:15)
#4 _flatterfrontendcompiler.compile(包:flatter_frontendcompiler\u服务器/server.dart:40:22)
#5启动器(包:颤振前端服务器/服务器。dart:178:27)
#6主要(file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
#7星形。(省道:隔离片/隔离片。省道:299:32)
#8 RawReceivePortImpl.handleMessage(dart:隔离补丁/隔离补丁。dart:168:12)
目标内核\u快照失败:异常:快照创建期间出错:null
生成失败。
失败:生成失败,出现异常。
*其中:
import 'package:sentry/browser_client.dart';
import 'package:sentry/sentry.dart';
import 'package:sentry/sentry.dart' if (dart.library.html) 'package:sentry/browser_client.dart' as sentry;