英文:
Errore while building apk with Flutter
问题
I have already tried using the --null-safety mode but than my app doesn't work.
我已经尝试使用--null-safety模式,但我的应用程序仍然无法运行。
When I use the debug mode on the emuletor I have no problems.
当我在模拟器上使用调试模式时,没有问题。
Any idea?
有什么想法吗?
Here the error message.
以下是错误消息。
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
Here my pubspec.yaml
以下是我的pubspec.yaml
name: name
描述: 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
I try to update all the dependencies but still don't work.
我尝试更新所有依赖项,但仍然无法运行。
英文:
I have already tried using the --null-safety mode but than my app doesn't work.
When I use the debug mode on the emuletor I have no problems.
Any idea?
Here the error message.
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
Here my 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
I try to update all the dependencies but still don't work.
答案1
得分: 0
看起来有一些 dependencies
不支持空安全,要解决这个问题,你可以升级你的依赖项。
升级依赖项到最新版本
运行
flutter pub outdated --mode=null-safety
来列出所有过时的包。
然后运行 flutter pub upgrade --null-safety
来自动升级所有的包。
或者使用以下命令在没有空安全的情况下运行你的应用程序。
flutter run --no-sound-null-safety
在更新之前最好保留正在工作的 git 分支
英文:
Seems some dependencies
not supporting null-safety and to solve this you can upgrade your dependencies
> To upgrade packages upto date
Run
flutter pub outdated --mode=null-safety
to print all outdated packages.,
And flutter pub upgrade --null-safety
to upgrade all packages automatically
> Or use below command to run your application without null-safety.
flutter run --no-sound-null-safety
Better to keep working git branch before update
答案2
得分: 0
我也面临着发布APK的问题。我尝试在gradle.properties
中进行更改。
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=false <---- 将其设置为false。
然后运行flutter build apk
命令。
英文:
I also facing release apk issue. I tried to change in the gradle.properties
.
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=false <---- make it false.
Then run flutter build apk
command
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论