运行 Flutter 项目后出错(任务 ':app:compileFlutterBuildDebug' 执行失败)

时间:2021-01-24 11:46:42

标签: flutter dart

Error:
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/effect/psd_drop_shadow_effect.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/effect/psd_effect.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/effect/psd_inner_glow_effect.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/effect/psd_inner_shadow_effect.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/effect/psd_outer_glow_effect.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/effect/psd_solid_fill_effect.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/layer_data/psd_layer_additional_data.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/psd_image_resource.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/psd_layer_data.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/pvrtc/pvrtc_color_bounding_box.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/tga/tga_info.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/tiff/tiff_info.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/webp/vp8l_color_cache.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/decode_info.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/encoder.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/hdr/hdr_gamma.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/util/interpolation.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/util/point.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/image_exception.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/internal/clamp.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/internal/internal.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/_component_data.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/util/quantizer.dart: Error: The control character U+0000 can only be used in strings and comments.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/draw/draw_circle.dart:50:6: Error: Type 'Point' not found.
List<Point> _calculateCircumference(Image image, int x0, int y0, int radius) {
     ^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/draw/draw_circle.dart:111:31: Error: Type 'Point' not found.
Image _draw(Image image, List<Point> points, int color) {
                              ^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/exr/exr_image.dart:11:24: Error: Type 'DecodeInfo' not found.
class ExrImage extends DecodeInfo {
                       ^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/exr/exr_part.dart:20:15: Error: Type 'ExrAttribute' not found.
  Map<String, ExrAttribute> attributes = {};
              ^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_data.dart:21:3: Error: Type 'JpegJfif' not found.
  JpegJfif jfif;
  ^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_data.dart:22:3: Error: Type 'JpegAdobe' not found.
  JpegAdobe adobe;
  ^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_data.dart:72:3: Error: Type 'JpegInfo' not found.
  JpegInfo readInfo(List<int> bytes) {
  ^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_data.dart:668:24: Error: Type 'JpegComponent' not found.
      JpegFrame frame, JpegComponent component) {
                       ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_scan.dart:181:24: Error: Type 'JpegComponent' not found.
  void _decodeBaseline(JpegComponent component, List zz) {
                       ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_scan.dart:210:23: Error: Type 'JpegComponent' not found.
  void _decodeDCFirst(JpegComponent component, List zz) {
                      ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_scan.dart:217:28: Error: Type 'JpegComponent' not found.
  void _decodeDCSuccessive(JpegComponent component, List zz) {
                           ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_scan.dart:221:23: Error: Type 'JpegComponent' not found.
  void _decodeACFirst(JpegComponent component, List zz) {
                      ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_scan.dart:247:28: Error: Type 'JpegComponent' not found.
  void _decodeACSuccessive(JpegComponent component, dynamic zz) {
                           ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_scan.dart:312:7: Error: Type 'JpegComponent' not found.
      JpegComponent component, dynamic decodeFn, int mcu, int row, int col) {
      ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/jpeg/jpeg_scan.dart:327:21: Error: Type 'JpegComponent' not found.
  void _decodeBlock(JpegComponent component, dynamic decodeFn, int mcu) {
                    ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/png/png_info.dart:6:23: Error: Type 'DecodeInfo' not found.
class PngInfo extends DecodeInfo {
                      ^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/layer_data/psd_layer_section_divider.dart:5:38: Error: Type 'PsdLayerData' not found.
class PsdLayerSectionDivider extends PsdLayerData {
                                     ^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/psd_image.dart:13:24: Error: Type 'DecodeInfo' not found.
class PsdImage extends DecodeInfo {
                       ^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/psd_layer.dart:35:15: Error: Type 'PsdLayerData' not found.
  Map<String, PsdLayerData> additionalData = {};
              ^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/psd/psd_layer.dart:39:8: Error: Type 'PsdEffect' not found.
  List<PsdEffect> effects = [];
       ^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/pvrtc/pvrtc_encoder.dart:289:10: Error: Type 'PvrtcColorBoundingBox' not found.
  static PvrtcColorBoundingBox _calculateBoundingBoxRgb(
         ^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/pvrtc/pvrtc_encoder.dart:322:10: Error: Type 'PvrtcColorBoundingBox' not found.
  static PvrtcColorBoundingBox _calculateBoundingBoxRgba(
         ^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/webp/vp8l.dart:962:3: Error: Type 'VP8LColorCache' not found.
  VP8LColorCache _colorCache;
  ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/webp/webp_info.dart:7:24: Error: Type 'DecodeInfo' not found.
class WebPInfo extends DecodeInfo {
                       ^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/decoder.dart:74:3: Error: Type 'DecodeInfo' not found.
  DecodeInfo startDecode(List<int> bytes);
  ^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/exr_decoder.dart:45:3: Error: Type 'DecodeInfo' not found.
  DecodeInfo startDecode(List<int> data) {
  ^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/formats/gif_decoder.dart:15:3: Error: Type 'GifInfo' not found.
  GifInfo info;
  ^^^^^^^
......
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_rectify.dart:8:5: Error: 'Point' isn't a type.
    Point topRight,
    ^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_rectify.dart:9:5: Error: 'Point' isn't a type.
    Point bottomLeft,
    ^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_rectify.dart:10:5: Error: 'Point' isn't a type.
    Point bottomRight,
    ^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_resize.dart:17:5: Error: 'Interpolation' isn't a type.
    Interpolation interpolation = Interpolation.nearest}) {
    ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_resize.dart:17:35: Error: Getter not found: 'Interpolation'.
    Interpolation interpolation = Interpolation.nearest}) {
                                  ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_resize.dart:19:11: Error: Method not found: 'ImageException'.
    throw ImageException('Invalid size');
          ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_resize.dart:42:24: Error: Getter not found: 'Interpolation'.
  if (interpolation == Interpolation.average) {
                       ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_resize.dart:77:31: Error: Getter not found: 'Interpolation'.
  } else if (interpolation == Interpolation.nearest) {
                              ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_resize_crop_square.dart:9:11: Error: Method not found: 'ImageException'.
    throw ImageException('Invalid size');
          ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_rotate.dart:8:6: Error: 'Interpolation' isn't a type.
    {Interpolation interpolation = Interpolation.nearest}) {
     ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/transform/copy_rotate.dart:8:36: Error: Getter not found: 'Interpolation'.
    {Interpolation interpolation = Interpolation.nearest}) {
                                   ^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/util/input_buffer.dart:136:13: Error: The method 'ImageException' isn't defined for the class 'InputBuffer'.
 - 'InputBuffer' is from 'package:image/src/util/input_buffer.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/util/input_buffer.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ImageException'.
      throw ImageException('EOF reached without finding string terminator');
            ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/util/neural_quantizer.dart:43:13: Error: The method 'ImageException' isn't defined for the class 'NeuralQuantizer'.
 - 'NeuralQuantizer' is from 'package:image/src/util/neural_quantizer.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/util/neural_quantizer.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ImageException'.
      throw ImageException('Image is too small');
            ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/bitmap_font.dart:53:15: Error: The method 'ImageException' isn't defined for the class 'BitmapFont'.
 - 'BitmapFont' is from 'package:image/src/bitmap_font.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/bitmap_font.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ImageException'.
        throw ImageException('Invalid font XML');
              ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/bitmap_font.dart:76:13: Error: The method 'ImageException' isn't defined for the class 'BitmapFont'.
 - 'BitmapFont' is from 'package:image/src/bitmap_font.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/bitmap_font.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ImageException'.
      throw ImageException('Invalid font archive');
            ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/bitmap_font.dart:88:15: Error: The method 'ImageException' isn't defined for the class 'BitmapFont'.
 - 'BitmapFont' is from 'package:image/src/bitmap_font.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/image-2.1.19/lib/src/bitmap_font.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ImageException'.
        throw ImageException('Invalid font XML');
              ^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.
  • 哪里: 脚本 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' 行:900

  • 出了什么问题: 任务 ':app:compileFlutterBuildDebug' 执行失败。

<块引用>

Process 'command 'C:\flutter\bin\flutter.bat'' 以非零退出值 1 结束

  • 试试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • https://help.gradle.org 获得更多帮助 请帮帮我!

我的错误和代码很长,堆栈溢出没有发布问题。 请帮我! 请帮我! 请帮帮我!

2 个答案:

答案 0 :(得分:0)

您的图像大小似乎未正确定义。使用 BoxFit 小部件进行调整。试试链接

https://medium.com/flutter-community/how-to-use-images-in-flutter-to-the-point-5542b4412a53

答案 1 :(得分:0)

您是否正在将 Base64 转换为解码图像?那么你应该遵循这个,那么你的问题就会得到解决。

    import 'dart:convert';
import 'package:image/image.dart' as ImageProcess;

final _byteImage = Base64Decoder().convert(base64Image);
Widget image = Image.memory(_byteImage)