[英]Unable to locate an executable at "/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jarsigner"
I'm trying to build a release bundle on android and for some reason, it started to give me this error:我正在尝试在 android 上构建一个发布包,由于某种原因,它开始给我这个错误:
Command:命令:
flutter build appbundle --target-platform android-arm,android-arm64 --build-number=$VERSION_CODE --build-name=$VERSION_NAME
Error:错误:
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
I've checked, the jarsigner binary is not on that directory.我检查过,jarsigner 二进制文件不在该目录中。 Tried to see if is somewhere installed with: whereas jarsigner
and is located in /usr/bin/jarsigner
试图查看是否在某个地方安装了: whereas jarsigner
并且位于/usr/bin/jarsigner
I tried to copy/symlink the file in the directory Android Studio expects it to be but once I do that and execute the build command again the bundleRelease task of Gradle remains at Running Gradle task 'bundleRelease'... (This is taking an unexpectedly long time.)
and doesn't finish.我试图复制/符号链接目录 Android Studio 中的文件,但是一旦我这样做并再次执行构建命令,Gradle 的bundleRelease任务仍然在Running Gradle task 'bundleRelease'... (This is taking an unexpectedly long time.)
并且没有完成。
I can build APK for Release without a problem.我可以毫无问题地构建用于发布的 APK。
Flutter Doctor output: Flutter 博士 output:
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 version outputs: 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)
I have always built an app like this, for more than a year.一年多来,我一直在构建这样的应用程序。
Thanks in advance for the help.在此先感谢您的帮助。
If you are using android studio, change the JDK Location used by Gradle from embedded to OpenJDK (the one you have installed manually)如果您使用的是 android studio,请将 Gradle 使用的 JDK Location 从嵌入式更改为 OpenJDK(您手动安装的那个)
Do a clean build then.然后做一个干净的构建。 Or create a new project and copy-paste old code.或者创建一个新项目并复制粘贴旧代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.