我已经试过使用--null-safety模式,但是我的应用程序不工作。当我在emuletor上使用调试模式时,我没有任何问题。有什么想法吗?
这里是错误消息。
flutter build apk
Building with sound null safety
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
- package:plugin_platform_interface
For solutions, see https://dart.dev/go/unsound-null-safety
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1070
* 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 31s
Running Gradle task 'assembleRelease'... 33,0s
Gradle task assembleRelease failed with exit code 1
这里是我的pubspec.yaml
name: name
description: desc
publish_to: 'none'
version: 1.0.16
environment:
sdk: ">=2.15.1 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.5
particles_flutter: ^0.1.4
sqflite: ^2.0.2
intl: ^0.18.0
flutter_staggered_grid_view: ^0.6.2
flex_color_picker: ^2.5.0
shared_preferences: ^2.0.15
# image_picker_form_field: ^0.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.4
我尝试更新所有依赖项,但仍然不起作用。
2条答案
按热度按时间6ie5vjzr1#
似乎有些
dependencies
不支持空安全,要解决这个问题,您可以升级您的依赖项将软件包升级到最新
运行
flutter pub outdated --mode=null-safety
以打印所有过期的软件包。,和
flutter pub upgrade --null-safety
自动升级所有软件包或者使用下面的命令来运行你的应用程序而不使用null安全。
unguejic2#
我也面临着发布apk的问题。我试着在
gradle.properties
中改变。然后运行
flutter build apk
命令