[英]Flutter build issue apk build fail
I am getting the following issue while building the apk:我在构建 apk 时遇到以下问题:
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:661:31: Error: Member not found: 'UnicodeChar'. /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:661:31:错误:找不到成员:'UnicodeChar' . int get UnicodeChar => Char.UnicodeChar;
int get UnicodeChar => Char.UnicodeChar; ^^^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:662:38: Error: Setter not found: 'UnicodeChar'.
^^^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:662: 38:错误:未找到设置器:'UnicodeChar'。 set UnicodeChar(int value) => Char.UnicodeChar = value;
设置 UnicodeChar(int value) => Char.UnicodeChar = value; ^^^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:664:29: Error: Member not found: 'AsciiChar'.
^^^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:664: 29:错误:找不到成员:'AsciiChar'。 int get AsciiChar => Char.AsciiChar;
int get AsciiChar => Char.AsciiChar; ^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:665:36: Error: Setter not found: 'AsciiChar'.
^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:665:36:错误:未找到 Setter:'AsciiChar'。 set AsciiChar(int value) => Char.AsciiChar = value;
设置 AsciiChar(int value) => Char.AsciiChar = value; ^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/flutter_calendar_carousel.dart:424:16: Error: The method 'FlatButton' isn't defined for the c lass '_CalendarState'.
^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/flutter_calendar_carousel.dart:424:16:错误:方法没有为 c lass '_CalendarState' 定义 'FlatButton'。
'_CalendarState' is from 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/ lib/flutter_calendar_carousel.dart'). '_CalendarState' 来自'package:flutter_calendar_carousel/flutter_calendar_carousel.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/flutter_calendar_carousel.dart') . Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
尝试将名称更正为现有方法的名称,或定义名为“FlatButton”的方法。 child: FlatButton( ^^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/src/calendar_header.dart:46:32: Error: The method 'FlatButton' isn't defined for the class 'C alendarHeader'.
孩子:FlatButton(^^^^^^^^^^ /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/src/calendar_header.dart:46 :32: 错误:没有为 class 'C alendarHeader' 定义方法 'FlatButton'。
'CalendarHeader' is from 'package:flutter_calendar_carousel/src/calendar_header.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/sr c/calendar_header.dart'). 'CalendarHeader' 来自'package:flutter_calendar_carousel/src/calendar_header.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/src/ calendar_header.dart')。 Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
尝试将名称更正为现有方法的名称,或定义名为“FlatButton”的方法。 Widget _headerTouchable() => FlatButton( ^^^^^^^^^^
小部件 _headerTouchable() => FlatButton( ^^^^^^^^^^
*********************************************************
WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX.警告:如果此版本的 flutter_webview_plugin 或其依赖项与 AndroidX 不兼容,它将破坏您的 Android 构建。 See https://docs.flutter.dev/development/platform-integration/android/androidx-migration for more information on the problem and how to fix it.
请参阅https://docs.flutter.dev/development/platform-integration/android/androidx-migration了解有关该问题以及如何解决该问题的更多信息。 This warning prints for all Android build failures.
此警告针对所有 Android 构建失败打印。 The real root cause of the error may be unrelated.
错误的真正根本原因可能是无关的。 *********************************************************
****************************************************** *******
FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。
Where: Script 'C:\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159其中:脚本 'C:\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' 行:1159
What went wrong: Execution failed for task ':app:compileFlutterBuildRelease'.出了什么问题:任务“:app:compileFlutterBuildRelease”执行失败。
Process 'command 'C:\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Process 'command 'C:\flutter\flutter\bin\flutter.bat'' 以非零退出值 1 结束
Try: Run with --stacktrace option to get the stack trace.尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.
使用 --info 或 --debug 选项运行以获得更多日志 output。 Run with --scan to get full insights.
运行 --scan 以获得完整的见解。
Get more help at https://help.gradle.org在https://help.gradle.org获得更多帮助
BUILD FAILED in 1m 20s Running Gradle task 'assembleRelease'... 81.7s Gradle task assembleRelease failed with exit code 1 BUILD FAILED in 1m 20s Running Gradle task 'assembleRelease'... 81.7s Gradle task assembleRelease 失败,退出代码为 1
Link to the project source code - https://drive.google.com/drive/folders/1GaNcymRQ1SmQDln-0JpsoEG_9Gy3sOn7?usp=sharing链接到项目源代码 - https://drive.google.com/drive/folders/1GaNcymRQ1SmQDln-0JpsoEG_9Gy3sOn7?usp=sharing
Please help as soon as possible.请尽快提供帮助。
Thank You谢谢你
By looking at this section of error, your dependencies might not be compatible with AndroidX.通过查看这部分错误,您的依赖项可能与 AndroidX 不兼容。
WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX.
警告:如果此版本的 flutter_webview_plugin 或其依赖项与 AndroidX 不兼容,它将破坏您的 Android 构建。
According to this github issue you need to migrate to AndroidX.根据此github 问题,您需要迁移到 AndroidX。 To migrate follow these steps -
要迁移,请按照以下步骤操作 -
1 - Open android directory with Android Studio 3.2+. 1 - 使用 Android Studio 3.2+ 打开 android 目录。
2 - Click on Refactor then migrate to AndroidX. 2 - 单击重构,然后迁移到 AndroidX。
After that add these to the gradle.properties file in the android directory.之后将这些添加到 android 目录中的 gradle.properties 文件中。
android.useAndroidX=true
android.enableJetifier=true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.