Roy Solberg
Roy Solberg

Reputation: 19643

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.

Upvotes: 7

Views: 1288

Answers (3)

Matt
Matt

Reputation: 1

The version of the JDK your system is using needs to be the same as the version Android Studio is using. For example, if running java -version tells you that you're using version 1.7 then Android Studio needs to be set to 1.7. This isn't a problem of using a version below 1.8...I am using 1.7.

Upvotes: 0

pdegand59
pdegand59

Reputation: 13019

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

Upvotes: 6

Roy Solberg
Roy Solberg

Reputation: 19643

I got around the problem by changing version of the Android Plugin for Gradle from version com.android.tools.build:gradle:2.0.0-alpha2 back to com.android.tools.build:gradle:1.5.0 in the project's build.gradle.

I had upgraded the plugin to be able to use Instant Run.

Also, tskulbru's suggestion about skipping building of the wear module worked as well.

Other attempts to fix this that did not work:

  • Separate installation of Android Studio 1.5.0 and 1.5.1 (stable channel)
  • Upgrade to com.android.tools.build:gradle:2.0.0-alpha3 (and later different versions up to beta6)
  • Upgrade to JDK 8u74
  • Upgrade to Android Studio 2.0 Beta 6

Upvotes: 1

Related Questions