Search code examples
javaandroidandroid-gradle-pluginandroid-studio-2.0

Android Studio 2.0 - NoSuchAlgorithmException: SHA256WITHDSA Signature not available


I'm running Android Studio 2.0 Preview 3b and trying to use "Generate Signed APK..." from the Build menu.

I get the following error Messages pane:

:wear:packageRelease FAILED
FAILURE: Build failed with an exception.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':wear:packageRelease'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
...
Error:org.gradle.tooling.BuildException: SHA256WITHDSA Signature not available: try using a newer JVM to build your application.
    at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:224)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:82)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 70 more
Error:java.security.NoSuchAlgorithmException: SHA256WITHDSA Signature not available
    at org.bouncycastle.jcajce.DefaultJcaJceHelper.createSignature(Unknown Source)
    at org.bouncycastle.operator.jcajce.OperatorHelper.createSignature(Unknown Source)

Android Studio is using JRE 1.7.0_55-b13 x86_64.

I see the try using a newer JVM to build your application. suggestion. Will it help to upgrade Java? Or how can I resolve this?

I haven't seen anywhere (e.g. http://tools.android.com/recent) that a Java upgrade is needed for Android Studio 2.0.


Solution

  • I just got the exact same problem with Android Studio 2.0 (the stable release) with com.android.tools.build:gradle:2.0.0.

    Even though my IDE was running with JDK 1.8_u77, I still had the problem.

    To fix it, go to Project Structure > SDK Location > make sure JDK location is set to a (at least 1.8) recent JDK ! (at the time of this post, the latest is 1.8_u77).