简体   繁体   中英

Flutter build issue apk build fail

I am getting the following issue while building the 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'. 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'. set 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'. 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'. set 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'.

  • '_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'). Try correcting the name to the name of an existing method, or defining a method named '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'.

  • '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'). Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'. Widget _headerTouchable() => FlatButton( ^^^^^^^^^^

     *********************************************************

WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX. See https://docs.flutter.dev/development/platform-integration/android/androidx-migration for more information on the problem and how to fix it. This warning prints for all Android build failures. The real root cause of the error may be unrelated. *********************************************************

FAILURE: Build failed with an exception.

  • Where: Script 'C:\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

  • What went wrong: Execution failed for task ':app:compileFlutterBuildRelease'.

Process 'command 'C:\flutter\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 1m 20s Running Gradle task 'assembleRelease'... 81.7s Gradle task assembleRelease failed with exit code 1

Link to the project source code - 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.

WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX.

According to this github issue you need to migrate to AndroidX. To migrate follow these steps -

1 - Open android directory with Android Studio 3.2+.

2 - Click on Refactor then migrate to AndroidX.

在此处输入图像描述

After that add these to the gradle.properties file in the android directory.

android.useAndroidX=true 
android.enableJetifier=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM