【问题标题】:Getting "Exception: Gradle task assembleDebug failed with exit code 1"获取“异常:Gradle 任务 assembleDebug 失败,退出代码为 1”
【发布时间】:2020-08-28 00:42:02
【问题描述】:

当我尝试开始评论flutter run时遇到问题。

我只有这个

lib/MyCart.dart:2:8: Error: Error when reading '../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/adobe_xd-0.1.4/lib/pinned.dart': No such file or directory
import 'package:adobe_xd/pinned.dart';                                  
       ^                                                                
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {                          
                         ^^^^^^^^^^^^^^^^^^^                            
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {        
                                           ^^^^^^^^^^^^^^^^^^^          
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {                          
      ^                                                                 
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type 'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {        
               ^                                                        
lib/MyCart.dart:285:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:304:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:321:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:338:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:356:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:373:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:390:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:524:21: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                    Pinned.fromSize(                                    
                    ^^^^^^                                              
lib/MyCart.dart:545:21: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                    Pinned.fromSize(                                    
                    ^^^^^^                                              
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no method named 'debugFillProperties'.
    super.debugFillProperties(properties);                              
          ^^^^^^^^^^^^^^^^^^^                                           
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method 'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
 - 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart' ('../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
      ifPresent: _completer?.toStringShort(),                           
                             ^^^^^^^^^^^^^                              
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no method named 'debugFillProperties'.
    super.debugFillProperties(description);                             
          ^^^^^^^^^^^^^^^^^^^                                           
                                                                        
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* Where:                                                                
Script '/Users/mbp/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 896
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildDebug'.              
> Process 'command '/Users/mbp/Developer/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 9s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        10.9s
Exception: Gradle task assembleDebug failed with exit code 1
Azzam-Almesbahi:jahezly mbp$ flutter run
Launching lib/main.dart on HRY LX1T in debug mode...
lib/MyCart.dart:2:8: Error: Error when reading '../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/adobe_xd-0.1.4/lib/pinned.dart': No such file or directory
import 'package:adobe_xd/pinned.dart';                                  
       ^                                                                
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {                          
                         ^^^^^^^^^^^^^^^^^^^                            
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {        
                                           ^^^^^^^^^^^^^^^^^^^          
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {                          
      ^                                                                 
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type 'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {        
               ^                                                        
lib/MyCart.dart:285:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:304:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:321:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:338:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:356:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:373:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:390:19: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                  Pinned.fromSize(                                      
                  ^^^^^^                                                
lib/MyCart.dart:524:21: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                    Pinned.fromSize(                                    
                    ^^^^^^                                              
lib/MyCart.dart:545:21: Error: The getter 'Pinned' isn't defined for the class 'MyCart'.
 - 'MyCart' is from 'package:jahezly/MyCart.dart' ('lib/MyCart.dart').  
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pinned'.
                    Pinned.fromSize(                                    
                    ^^^^^^                                              
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no method named 'debugFillProperties'.
    super.debugFillProperties(properties);                              
          ^^^^^^^^^^^^^^^^^^^                                           
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method 'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
 - 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart' ('../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
      ifPresent: _completer?.toStringShort(),                           
                             ^^^^^^^^^^^^^                              
../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no method named 'debugFillProperties'.
    super.debugFillProperties(description);                             
          ^^^^^^^^^^^^^^^^^^^                                           
                                                                        
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* Where:                                                                
Script '/Users/mbp/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 896
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildDebug'.              
> Process 'command '/Users/mbp/Developer/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 9s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        11.3s
Exception: Gradle task assembleDebug failed with exit code 1

【问题讨论】:

标签: android flutter visual-studio-code


【解决方案1】:

在您的 pubspec.yaml 中,更新 flutter_svg 和 adobeXD 包

flutter_svg: ^0.18.0
adobe_xd: ^1.0.0+1

运行flutter cleanflutter pub upgrade

由于在最近的 Flutter 更新中删除了 DiagnosticableMixin 导致错误发生,这影响了几个使用 DiagnosticableMixin 的 Flutter 包。

这个问题现在已经解决,正如这个 flutter_svg 包 GitHub issue 中所指出的那样。

由于您使用包含 Pinned 类的旧版本的包而导致 Adob​​eXD 包出现问题

【讨论】:

    猜你喜欢
    • 2021-08-02
    • 2020-10-31
    • 2021-06-20
    • 2020-11-06
    • 1970-01-01
    • 2021-06-13
    • 2021-10-01
    • 2021-06-09
    • 2019-11-05
    相关资源
    最近更新 更多