来自 /root/.pub-cache/hosted/pub.dartlang.org 包的 Flutter 调试编译错误
Flutter debug compilation error from /root/.pub-cache/hosted/pub.dartlang.org packages
我两天前升级到 Flutter 2.0,开始面对 Execution failed for task ':app:compileFlutterBuildDebug'
由于一些软件包。
然后我降级了,但错误仍然存在。我的 pubspec.yaml
如下所示,
name: news_app
description: A news app
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.3+11
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
curved_navigation_bar: ^0.3.1
http: ^0.12.0
webview_flutter:
flutter_webview_plugin:
flutter_cache_manager: ^1.1.2
flutter_widget_from_html_core:
flutter_widget_from_html:
flutter_html:
flutter_swiper: ^1.1.6
page_view_indicators: ^1.3.0
splashscreen: ^1.2.0
intl: ^0.16.1
jiffy: ^2.2.0
dio: ^3.0.8
dio_http_cache: ^0.2.4
shared_preferences: ^0.5.3
connectivity: ^0.4.2
share: ^0.6.3+3
sqflite: any
path_provider:
timeago: any
auto_size_text: ^2.1.0
flutter_tts: ^0.6.0
firebase_messaging: ^6.0.16
in_app_update: ^1.1.11
upgrader: ^0.10.0
imei_plugin: 1.1.6
firebase_analytics: ^5.0.14
flutter_local_notifications: ^1.4.4+1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: any
flutter_icons:
image_path: "assets/TBS_logo.jpg"
android: true
ios: true
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
fonts:
- family: sourcePro
fonts:
- asset: assets/SourceSansPro-Light.ttf
- family: serifPro
fonts:
- asset: assets/SourceSerifPro-Light.otf
- family: metaSerifPro
fonts:
- asset: assets/FFMetaSerifPro-Light.ttf
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/logo.jpeg
- assets/tbs_logo_transparent.png
- assets/TBS.png
- assets/TBS_logo.jpg
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
导致错误的软件包是 chewie-0.9.10
和 flutter_svg-0.18.1
。但问题是这两个包中的 none 在我的 pubspec.yaml
中。错误如下。
/root/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,
^^^^^^
../../flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
static Locale localeOf(BuildContext context) {
^^^^^^^^
/root/.pub-cache/hosted/pub.dartlang.org/chewie-0.9.10/lib/src/chewie_player.dart:83:7: Error: No named parameter with the name 'resizeToAvoidBottomPadding'.
resizeToAvoidBottomPadding: false,
^^^^^^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/material/scaffold.dart:1449:9: Context: Found this candidate, but the arguments don't match.
const Scaffold({
^^^^^^^^
/root/.pub-cache/hosted/pub.dartlang.org/chewie-0.9.10/lib/src/chewie_player.dart:276:17: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../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)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
我尝试过的一切,
- 从 flutter 2.0 降级,因为升级前一切正常。
- 尝试了 运行宁
flutter clean
然后 运行.
- 试过运行宁
flutter pub cache repair
- 我删除了整个
/root/.pub-cache/hosted/
目录并做了 运行 flutter pub get
.
- 试过运行宁
dart pub upgrade
- 我什至完全重新安装了 flutter。
对我没有任何作用。我尝试了通过在 SO 和其他地方搜索找到的所有内容。
感谢阅读。
我遇到了同样的问题。原来我的一些包与 flutter 2.0 不兼容。
我通过将我的软件包升级到最新版本解决了这个问题。您可以通过在 pubspec.yaml 中手动更新它们或通过 flutter pub upgrade --major-versions
来完成
我两天前升级到 Flutter 2.0,开始面对 Execution failed for task ':app:compileFlutterBuildDebug'
由于一些软件包。
然后我降级了,但错误仍然存在。我的 pubspec.yaml
如下所示,
name: news_app
description: A news app
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.3+11
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
curved_navigation_bar: ^0.3.1
http: ^0.12.0
webview_flutter:
flutter_webview_plugin:
flutter_cache_manager: ^1.1.2
flutter_widget_from_html_core:
flutter_widget_from_html:
flutter_html:
flutter_swiper: ^1.1.6
page_view_indicators: ^1.3.0
splashscreen: ^1.2.0
intl: ^0.16.1
jiffy: ^2.2.0
dio: ^3.0.8
dio_http_cache: ^0.2.4
shared_preferences: ^0.5.3
connectivity: ^0.4.2
share: ^0.6.3+3
sqflite: any
path_provider:
timeago: any
auto_size_text: ^2.1.0
flutter_tts: ^0.6.0
firebase_messaging: ^6.0.16
in_app_update: ^1.1.11
upgrader: ^0.10.0
imei_plugin: 1.1.6
firebase_analytics: ^5.0.14
flutter_local_notifications: ^1.4.4+1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: any
flutter_icons:
image_path: "assets/TBS_logo.jpg"
android: true
ios: true
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
fonts:
- family: sourcePro
fonts:
- asset: assets/SourceSansPro-Light.ttf
- family: serifPro
fonts:
- asset: assets/SourceSerifPro-Light.otf
- family: metaSerifPro
fonts:
- asset: assets/FFMetaSerifPro-Light.ttf
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/logo.jpeg
- assets/tbs_logo_transparent.png
- assets/TBS.png
- assets/TBS_logo.jpg
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
导致错误的软件包是 chewie-0.9.10
和 flutter_svg-0.18.1
。但问题是这两个包中的 none 在我的 pubspec.yaml
中。错误如下。
/root/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,
^^^^^^
../../flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
static Locale localeOf(BuildContext context) {
^^^^^^^^
/root/.pub-cache/hosted/pub.dartlang.org/chewie-0.9.10/lib/src/chewie_player.dart:83:7: Error: No named parameter with the name 'resizeToAvoidBottomPadding'.
resizeToAvoidBottomPadding: false,
^^^^^^^^^^^^^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/material/scaffold.dart:1449:9: Context: Found this candidate, but the arguments don't match.
const Scaffold({
^^^^^^^^
/root/.pub-cache/hosted/pub.dartlang.org/chewie-0.9.10/lib/src/chewie_player.dart:276:17: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../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)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
我尝试过的一切,
- 从 flutter 2.0 降级,因为升级前一切正常。
- 尝试了 运行宁
flutter clean
然后 运行. - 试过运行宁
flutter pub cache repair
- 我删除了整个
/root/.pub-cache/hosted/
目录并做了 运行flutter pub get
. - 试过运行宁
dart pub upgrade
- 我什至完全重新安装了 flutter。
对我没有任何作用。我尝试了通过在 SO 和其他地方搜索找到的所有内容。
感谢阅读。
我遇到了同样的问题。原来我的一些包与 flutter 2.0 不兼容。
我通过将我的软件包升级到最新版本解决了这个问题。您可以通过在 pubspec.yaml 中手动更新它们或通过 flutter pub upgrade --major-versions