【问题标题】:Execution failed for task ':app:compileFlutterBuildRelease'. on Flutter creating APK任务 ':app:compileFlutterBuildRelease' 执行失败。关于 Flutter 创建 APK
【发布时间】:2021-08-03 10:25:33
【问题描述】:

我正在使用最新的 Android Studio。有编译错误不知道怎么弄??

D:\path\of\project>flutter build apk

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Running Gradle task 'assembleRelease'...
lib/ui/screens/splash_screen.dart:52:20: Error: The getter 'updateAvailable' isn't defined for the class 'AppUpdateInfo'.

 - 'AppUpdateInfo' is from 'package:in_app_update/in_app_update.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/in_app_update-2.0.0/lib/in_app_update.da
rt').

Try correcting the name to the name of an existing getter, or defining a getter or field named 'updateAvailable'.

    if(_updateInfo.updateAvailable){

                   ^^^^^^^^^^^^^^^

lib/ui/screens/intro_screen.dart:208:7: Error: No named parameter with the name 'shouldHideStatusBar'.

      shouldHideStatusBar: false,

      ^^^^^^^^^^^^^^^^^^^

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/intro_slider-2.4.3/lib/intro_slider.dart:149:3: Context: Found this candidate, but the arguments don't match.

  IntroSlider({

  ^^^^^^^^^^^

lib/ui/screens/home_screen.dart:55:24: Error: The method 'configure' isn't defined for the class 'FirebaseMessaging'.

 - 'FirebaseMessaging' is from 'package:firebase_messaging/firebase_messaging.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-8.0.0-d
ev.15/lib/firebase_messaging.dart').

Try correcting the name to the name of an existing method, or defining a method named 'configure'.

    _firebaseMessaging.configure(

                       ^^^^^^^^^

lib/services/download/download_episode_page.dart:839:29: Error: The method 'split' isn't defined for the class 'Object'.

 - 'Object' is from 'dart:core'.

Try correcting the name to the name of an existing method, or defining a method named 'split'.

    var newFile = cFileName.split('/').last;

                            ^^^^^

lib/services/download/download_page.dart:921:33: Error: The method 'split' isn't defined for the class 'Object'.

 - 'Object' is from 'dart:core'.

Try correcting the name to the name of an existing method, or defining a method named 'split'.

    var fileNamenew = cFileName.split('/').last;

                                ^^^^^

lib/custom_player/src/chewie_player.dart:86:7: Error: No named parameter with the name 'resizeToAvoidBottomPadding'.

      resizeToAvoidBottomPadding: false,

      ^^^^^^^^^^^^^^^^^^^^^^^^^^

/C:/src/flutter/packages/flutter/lib/src/material/scaffold.dart:1451:9: Context: Found this candidate, but the arguments don't match.

  const Scaffold({

        ^^^^^^^^

lib/custom_player/src/chewie_player.dart:279:17: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.

 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').

Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.

        context.inheritFromWidgetOfExactType(_ChewieControllerProvider)

                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^





FAILURE: Build failed with an exception.



* Where:

Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991



* What went wrong:

Execution failed for task ':app:compileFlutterBuildRelease'.

> Process 'command 'C:\src\flutter\bin\flutter.bat'' 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 4m 0s
Running Gradle task 'assembleRelease'...                          241.8s
Gradle task assembleRelease failed with exit code 1

如果我看一下颤振医生 -v 它会显示

D:\path\of\project>flutter doctor -v
[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 6.1.7601], locale en-US)
    • Flutter version 2.0.6 at C:\src\flutter
    • Framework revision 1d9032c7e1 (13 days ago), 2021-04-29 17:37:58 -0700
    • Engine revision 05e680e202
    • Dart version 2.12.3

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Home\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Java\jdk1.8.0_131\bin\java
    • Java version Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212


请告诉我该如何解决?

我在颤振上使用“稳定”连接。我确实升级了颤振和污垢。所有的插件都安装了,但它不工作..而且也像

“错误:没有为类 'AppUpdateInfo' 定义 getter 'updateAvailable'。” “错误:没有名为‘shouldHideStatusBar’的命名参数。” “错误:没有为类‘FirebaseMessaging’定义方法‘configure’。” “错误:没有为类 'Object' 定义方法 'split'。” “错误:没有名为‘resizeToAvoidBottomPadding’的命名参数。” “错误:没有为类‘BuildContext’定义方法‘inheritFromWidgetOfExactType’。” 一切尽在一处。

我什么都试过了。。还是有问题。

谢谢

【问题讨论】:

  • 试试flutter clean
  • 这么多次......什么也没发生。 flutter clean - 谢谢你,还有别的吗?

标签: java android flutter gradle flutter-dependencies


【解决方案1】:

这是由于您使用的 Flutter 版本所致。尝试将您的 Flutter 版本更改为 1.2 可能会有所帮助。 如我所见,IntroSlider ChewPlayer 中存在错误。尝试更新此插件并检查它的属性,例如 shouldHideStatusBar 现在是 hidestatusbar。您必须手动查找所有更改。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-23
    • 2021-02-19
    • 2020-03-25
    • 2021-06-19
    • 2022-06-21
    • 1970-01-01
    • 2021-02-06
    • 2021-09-25
    相关资源
    最近更新 更多