无法在“/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jarsigner"中找到可执行文件; [英] Unable to locate an executable at "/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jarsigner"

查看:205
本文介绍了无法在“/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jarsigner"中找到可执行文件;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 android 上构建一个发布包,但出于某种原因,它开始给我这个错误:

I'm trying to build a release bundle on android and for some reason, it started to give me this error:

命令:

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

I've checked, the jarsigner binary is not on that directory. Tried to see if is somewhere installed with: whereas jarsigner and is located in /usr/bin/jarsigner

我试图在 Android Studio 期望的目录中复制/符号链接文件,但是一旦我这样做并再次执行构建命令,Gradle 的 bundleRelease 任务仍然在 Running Gradle任务 'bundleRelease'...(这出乎意料地花费了很长时间.) 并且没有完成.

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.

我可以毫无问题地为 Release 构建 APK.

I can build APK for Release without a problem.

Flutter Doctor 输出:

Flutter Doctor 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 版本输出:

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.

预先感谢您的帮助.

推荐答案

如果您使用的是 android studio,请将 Gradle 使用的 JDK Location 从嵌入式更改为 OpenJDK(您手动安装的那个)

If you are using android studio, change the JDK Location used by Gradle from embedded to OpenJDK (the one you have installed manually)

然后进行干净的构建.或者创建一个新项目并复制粘贴旧代码.

Do a clean build then. Or create a new project and copy-paste old code.

这篇关于无法在“/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jarsigner"中找到可执行文件;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆