这是我的pubspec.yaml
当我运行不带图像选择器的pub get时,它可以工作。
name: project1
description: A new Flutter application.
publish_to:
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
camera:
image_picker: ^0.6.1+4
image_cropper:
path_provider:
path:
flutter_local_notifications: ^1.4.4+2
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
但是当我将image_picker从最新版本添加到0.6.0时,它会显示相同的错误消息
插件
flutter_plugin_android_lifecycle
在C:\ Users \ john \ Documents \ flutter_windows_1.17.1-stable \ flutter.pub-cache \ hosted \ pub.dartlang.org \ flutter_plugin_android_lifecycle-中没有定义的主类1.0.8 \ android \ src \ main \ java \ io \ flutter \ plugins \ flutter_plugin_android_lifecycle \ FlutterAndroidLifecyclePlugin.java或C:\ Users \ john \ Documents \ flutter_windows_1.17.1-stable \ flutter.pub-cache \ hosted \ pub.dartlang .org \ flutter_plugin_android_lifecycle-1.0.8 \ android \ src \ main \ kotlin \ io \ flutter \ plugins \ flutter_plugin_android_lifecycle \ FlutterAndroidLifecyclePlugin.kt。这可能是由于插件的pubspec.yaml中的androidPackage: io.flutter.plugins.flutter_plugin_android_lifecycle
或mainClass
输入错误所致。 如果您是此插件的作者,请修复androidPackage
条目或将主类移动到上面使用的任何位置。否则,请联系此插件的作者,并考虑同时使用其他插件。
我尝试运行不带image_picker的其他项目,它们似乎运行良好。我就是无法安装image_picker。
答案 0 :(得分:0)
我尝试在Flutter 1.17.5中导入•通道稳定。一切正常。您可以升级Flutter,然后重试吗?
答案 1 :(得分:0)
删除 .pub-cache
个文件夹
运行 flutter pub get
命令
如果这不起作用试试
在您的 yaml 文件中添加 flutter_plugin_android_lifecycle
依赖项
删除.pub-cache
文件夹
运行 flutter pub get
命令