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.
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.