【发布时间】:2022-01-23 18:37:45
【问题描述】:
我在构建我的颤振应用程序时遇到以下错误。在模拟器上测试应用程序时我没有收到任何错误,并且运行良好。我不知道这栋楼出了什么问题。感谢您提供的任何帮助。
颤振版本:v2.5.3 |开发工具:v2.8.0
我正在使用这个命令来构建应用程序:
flutter build apk --split-per-abi
这是错误日志:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageRelease'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
> com.android.ide.common.signing.KeytoolException: Failed to read key upload from store "/Users/USER_NAME/Documents/APP_NAME/main_files/source/wordpress_app/android/app/upload-keystore.jks": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
> com.android.ide.common.signing.KeytoolException: Failed to read key upload from store "/Users/USER_NAME/Documents/APP_NAME/main_files/source/wordpress_app/android/app/upload-keystore.jks": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
> com.android.ide.common.signing.KeytoolException: Failed to read key upload from store "/Users/USER_NAME/Documents/APP_NAME/main_files/source/wordpress_app/android/app/upload-keystore.jks": Integrity check failed: java.security.NoSuchAlgorithmException: 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 2m 14s
Running Gradle task 'assembleRelease'... 135.8s
Gradle task assembleRelease failed with exit code 1
【问题讨论】:
-
你的java是最新的吗?您的上传密钥在预期的位置吗?这就是我首先要检查的内容。
-
是的,我使用的是最新的 java 版本。而且我的 upload-keystore.jks 文件也在预期的位置。即:/users/MY_USERNAME/upload-keystore.jks
-
你的钥匙有问题。你是如何产生它的?您的 key.properties 是否正确填写?
-
我使用以下命令生成它:keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload ..(我的应用程序运行良好在模拟器中——构建时唯一的问题。)我的 key.properties 也正确填充。
-
密钥用于签署您的发布 APK,这就是为什么您在调试环境中运行时不会出错的原因。也许您会发现此页面对您有所帮助 (docs.flutter.dev/deployment/android)