簡體   English   中英

無法在“/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"

我正在嘗試在 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.)並且沒有完成。

我可以毫無問題地構建用於發布的 APK。

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 版本輸出:

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)

一年多來,我一直在構建這樣的應用程序。

在此先感謝您的幫助。

如果您使用的是 android studio,請將 Gradle 使用的 JDK Location 從嵌入式更改為 OpenJDK(您手動安裝的那個)

在此處輸入圖像描述

然后做一個干凈的構建。 或者創建一個新項目並復制粘貼舊代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM