我正在尝试在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二进制文件不在该目录中。试图看看是否已经安装了jarsigner
,并且它位于/usr/bin/jarsigner
。
我尝试将文件复制/符号链接到Android Studio期望它存在的目录中,但是一旦我这样做并再次执行构建命令,Gradle的bundleRelease任务仍然停留在Running Gradle task 'bundleRelease'... (This is taking an unexpectedly long time.)
,无法完成。
我可以轻松地构建发布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)
我已经构建了一款类似的应用程序超过一年时间。
提前感谢您的帮助。
# 个人脚本 PATH="$PATH:$HOME/bin" PATH="$PATH:/usr/local/ant/bin" PATH="$PATH:/usr/local/tomcat/bin" export PATH
否则,这似乎是对该位置的错误引用。 - BuzZin'