首页 > 解决方案 > 构建颤振应用程序时发生错误

问题描述

我正在尝试使用带有以下命令的 Android Studio 构建一个颤振应用程序:flutter build appbundle --target-platform android-arm,android-arm64,android-x64

但我在日志中收到此错误:

E:\User\Application\flutter_application>flutter build appbundle --target-platf
orm android-arm,android-arm64,android-x64
Running "flutter pub get" in flutter_application...                17.1s

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.1.1\andr
oid\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.jav
a uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.
4\android\src\main\java\io\flutter\plugins\googlemaps\Convert.java uses or overr
ides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.
4\android\src\main\java\io\flutter\plugins\googlemaps\TileProviderController.jav
a uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-1.1.4\andr
oid\src\main\java\io\flutter\plugins\firebase\auth\FlutterFirebaseAuthPlugin.jav
a uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-2.1.0\an
droid\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFiresto
rePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-2.1.0\an
droid\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\Transact
ionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_storage-8.0.6\android
\src\main\java\io\flutter\plugins\firebase\storage\FlutterFirebaseStoragePlugin.
java:38: warning: [deprecation] Registrar in PluginRegistry has been deprecated
  public static void registerWith(PluginRegistry.Registrar registrar) {
                                                ^
1 warning
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Removed unused resources: Binary resource data reduced from 174KB to 148KB: Remo
ved 14%

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Wor
kers$ActionFacade
   > Failed to read key key from store "E:\User\Application\flutter_applicatio
n\android\app\key.jks": Integrity check failed: java.security.NoSuchAlgorithmExc
eption: Algorithm HmacPBESHA256 not available

* 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 13m 46s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done                       834.3s
Gradle task bundleRelease failed with exit code 1

我正在使用最新版本的 Flutter 2 和最新版本的 android studio,对于 firebase,我将它用于聊天和推送通知。

我尝试了许多解决方案,例如运行 flutter pub get 和 flutter clean ,但似乎没有任何效果,我也尝试重新生成 jks 并重新上传 google_services.json 关于解决方案的任何想法,好吗?

标签: androidfirebaseflutterflutter-dependencies

解决方案


昨天,我在 Flutter 应用中尝试使用 firebase 时也遇到了同样的错误。作为一个完整的初学者,我对后台发生的事情知之甚少,但是通过网络我发现更改 minSDK 版本可能会有所帮助。所以,我试了一下,对我来说效果很好。它现在不会抛出任何错误。我做了什么?

  1. 转到您的应用级别 build.gradle 文件
  2. 将 minSdkVersion 更改为 23,最初设置为 16。试一试。也试试

flutter pub get
flutter pub upgrade
flutter clean
flutter run

否则,通过官方文档始终是一个明智的决定。


推荐阅读