我正在尝试在 android 上构建一个发布包,但出于某种原因,它开始给我这个错误:
命令:
flutter build appbundle --target-platform android-arm,android-arm64 --build-number=$VERSION_CODE --build-name=$VERSION_NAME
错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageReleaseBundle'.
> java.util.concurrent.ExecutionException: java.lang.RuntimeException: jarsignerfailed with exit code 2 :
Unable to locate an executable at "/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jarsigner" (-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 1m 0s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done 61.8s
Gradle task bundleRelease failed with exit code 1
我已经检查过,jarsigner 二进制文件不在该目录中。
尝试查看是否安装了:whereas jarsigner
并且位于 /usr/bin/jarsigner
我试图在 Android Studio 期望的目录中复制/符号链接文件,但是一旦我这样做并再次执行构建命令,Gradle 的 bundleRelease 任务仍保持在 Running Gradle task 'bundleRelease'... (This is taking an unexpectedly long time.)
并没有完成。
我可以毫无问题地为 Release 构建 APK。
Flutter Doctor 输出:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.6 19G2021 darwin-x64, locale en-AL)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
[!] Android Studio (version 4.2)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart-specific functionality.
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
Java 版本输出:
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)
我一直开发这样的应用,已经一年多了。
预先感谢您的帮助。