Gradle任务assembleDebug失败,退出代码为1,如何解决此问题?

时间:2019-12-21 16:29:30

标签: flutter dart

请在下面查看错误

    Launching lib/main.dart on SM G965F in debug mode...
    Running Gradle task 'assembleDebug'...

编译器消息:

    ../../../../minhpham/flutter/.pub-cache/hosted/pub.dartlang.org/cached_network_image-1.1.3/lib/src/cached_network_image_provider.dart:42:24: Error: The method 'CachedNetworkImageProvider.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'.
      ImageStreamCompleter load(CachedNetworkImageProvider key) {
                       ^
    ../../../../minhpham/flutter/packages/flutter/lib/src/painting/image_provider.dart:403:24: Context: This is the overridden method ('load').
    ImageStreamCompleter load(T key, DecoderCallback decode);
                       ^
    Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
    build failed.

    FAILURE: Build failed with an exception.

    * Where:
    Script '/Users/minhpham/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 780

    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command '/Users/minhpham/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 18s
Finished with error: Gradle task assembleDebug failed with exit code 1

并查看日志记录

    2019-12-21 19:27:55.477 4569-5133/? D/bauth_FPBAuthService: thread id : 1, preenroll_flag : 0, nd cnt : 0, cso : 0, et : 0
    2019-12-21 19:27:55.477 4569-5133/? D/bauth_FPBAuthService: FPBAuthService, 9983
    2019-12-21 19:27:55.519 8312-8312/? I/SKBD: anc isTosAccept false
    2019-12-21 19:27:55.921 8312-8312/? I/chatty: uid=10160(com.sec.android.inputmethod) identical 2 lines
    2019-12-21 19:27:56.123 8312-8312/? I/SKBD: anc isTosAccept false
    2019-12-21 19:27:56.257 4337-10083/? V/APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
    2019-12-21 19:27:56.258 4337-10083/? V/APM_AudioPolicyManager: getNewOutputDevice() selected device 0
    2019-12-21 19:27:56.258 4337-10083/? V/APM_AudioPolicyManager: ### curdevice : 2
    2019-12-21 19:27:56.324 8312-8312/? I/SKBD: anc isTosAccept false
    2019-12-21 19:27:56.478 4569-5133/? D/bauth_FPBAuthService: pcf : 0x1012, 0 ,1 ,0 ,0 ,0 ,0, 
    2019-12-21 19:27:56.478 4569-5133/? D/bauth_FPBAuthService: thread id : 1, preenroll_flag : 0, nd cnt : 0, cso : 0, et : 0
    2019-12-21 19:27:56.478 4569-5133/? D/bauth_FPBAuthService: FPBAuthService, 9983
    2019-12-21 19:27:56.524 8312-8312/? I/SKBD: anc isTosAccept false
    2019-12-21 19:27:56.598 11472-11472/? I/omobile.apploc: Explicit concurrent copying GC freed 18(32KB) AllocSpace objects, 0(0B) LOS objects, 55% free, 4MB/10MB, paused 670us total 139.080ms
    2019-12-21 19:27:56.725 8312-8312/? I/SKBD: anc isTosAccept false

2 个答案:

答案 0 :(得分:1)

您需要升级到cached_network_image 2.0.0-rc

如何安装? 将此添加到您程序包的pubspec.yaml文件中:

dependencies:
  cached_network_image: ^2.0.0-rc

此外,他们在自己的pub.dev Page

中提到了此问题
  

如果遇到以下错误之一,请升级到2.0.0-rc。

The method 'ScaledFileImage.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'

The method 'CachedNetworkImageProvider.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'

答案 1 :(得分:-1)

尝试使用cached_network_image: ^2.0.0-rc.1

小于1.3.1的版本在波动1.10.15之后会出现问题。

别忘了使用flutter pub升级

相关问题