1

I ran into this exception while trying to build an Android App Bundle (.aab). Below is the exception which is reported : java.util.concurrent.ExecutionException: java.lang.RuntimeException: 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)

I also see that the jarsigner was actually missing in the embeded JDK. I also couldn't find the option to change the JDK in Android Studio.

Use the below mentioned release :

Android Studio 4.2.1 Build #AI-202.7660.26.42.7351085, built on May 10, 2021 Runtime version: 11.0.8+10-b944.6916264 x86_64 VM: OpenJDK 64-Bit Server VM by N/A macOS 10.15.7

Steps to Reproduce :

Build -> Generate Signed Bundle / APK -> Use a valid certificate and try signing the app.

Kingston
  • 474
  • 5
  • 14
  • 2
    @Robert: OP is trying to sign an App Bundle, not an APK. For App Bundles, jarsigner is used, not apksigner. [Source](https://developer.android.com/studio/build/building-cmdline#bundle_build_gradle) – Pierre Jun 08 '21 at 08:11
  • @Kingston: what version of the jdk is this? What's the output of `java -version` ? – Pierre Jun 08 '21 at 08:14
  • I tried reverting back to 4.1.3 and it worked fine. I will now install the latest version and try again. – Kingston Jun 08 '21 at 08:52
  • My JDK version is as follows : openjdk 11.0.8 2020-07-14 OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) OpenJDK 64-Bit Server VM (build 11.0.8+10-b944.6916264, mixed mode) – Kingston Jun 08 '21 at 08:57
  • Tried using Android Studio 4.2.0, it failed too. – Kingston Jun 08 '21 at 09:27
  • The java -version when using Android Studio 4.1.3 is this : java 13.0.2 2020-01-14 Java(TM) SE Runtime Environment (build 13.0.2+8) Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing) – Kingston Jun 08 '21 at 09:28
  • Seems to be a duplicate of https://stackoverflow.com/questions/67718729/android-studio-4-2-1-where-is-jarsigner-now, but neither question has a satisfactory answer yet. – drdaanger Jun 29 '21 at 16:14
  • @drdaanger Please check my answer, you might also be running in to the same issue like me. – Kingston Jul 02 '21 at 09:58

1 Answers1

0

In my case the issue was because of the outdated Android Gradle Plugin. After the Android Gradle Plugin and Gradle to the latest version, the issue is resolved and I was able to make a release build.

Kingston
  • 474
  • 5
  • 14