Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 510
Roy Solberg Avatar asked Dec 16 '15 17:12

Roy Solberg


2 Answers

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

like image 61
pdegand59 Avatar answered Nov 05 '22 15:11

pdegand59


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
like image 1
Roy Solberg Avatar answered Nov 05 '22 15:11

Roy Solberg