8

I am trying to update an existing Android app, but while generating a Signed APK the following error message appears: Algorithm HmacPBESHA256 not available

I have searched the internet for a solution, including here on StackOverflow, but I cannot find one anywhere. I know that the current keystore uses SHA1withRSA, but how to convert it to HmacPBESHA256 I would not know. Google Play support unfortunately can't help me either, as this question is too technical.

For the sake of clarity here is the full notification:

Execution failed for task ':app:packageRelease'. A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable com.android.ide.common.signing.KeytoolException: Failed to read key 1 from store "/Users/KDApps/Documents/KDApps/original-signing-keystore.jks": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available

KDApps
  • 91
  • 1
  • 1
  • 3
  • 1
    This is problem in Java that could not find encryption algorithm. Its support was added in [Java 12](https://docs.oracle.com/en/java/javase/12/security/oracle-providers.html#GUID-A47B1249-593C-4C38-A0D0-68FA7681E0A7). See similar discussion: https://stackoverflow.com/a/59625191/13482100 – Kuzneц May 13 '21 at 08:05
  • 1
    @Kuzneц I am using Java 16, But still getting this error. Am I missing anything else? – ThinkAndCode Jun 16 '21 at 07:28
  • 1
    There are several places where java is used. I'd started with setting JAVA_HOME pointing to JDK 16, and tried to play with JDK16/bin/keytool. If it worked out of the box - I'd double checked JVM that is used to run Gradle. By default Android Studio uses its own distribution of JDK11 to run gradle process. Check this discussion: https://stackoverflow.com/questions/19608742/how-to-set-java-sdk-path-in-androidstudio – Kuzneц Jun 18 '21 at 09:11
  • This works fine for me guys :) [https://stackoverflow.com/a/69697914/5958045](https://stackoverflow.com/a/69697914/5958045) – organicnz Oct 24 '21 at 14:55
  • This works fine for me guys :) [https://stackoverflow.com/a/69697914/5958045](https://stackoverflow.com/a/69697914/5958045) – organicnz Oct 24 '21 at 15:01

7 Answers7

10

Make sure JDK is installed.

File -> Project Structure -> SDK Location -> Gradle Settings -> change the gradle JDK to the correct one.

James Barboza
  • 111
  • 1
  • 2
5

The problem occurs due to Missing Java Environment variable or mismatch between Android jdk and already set java environment variable version. To solve this set jdk to environment variable version.

Vidyesh Churi
  • 1,899
  • 1
  • 24
  • 33
  • 3
    This worked for me. I set JAVA_HOME value equal to Java 11 JDK and set gradle to use the same JDK to compile the project. – Ildar Zaripov Feb 01 '22 at 23:46
2

I solved this problem by entering "File" -> "Settings" -> "Build, Execution, Deployment" -> "Build Tools" -> "Gradle" and selected appropriate "Gradle JDK" version.

ouflak
  • 2,458
  • 10
  • 44
  • 49
Rog
  • 21
  • 1
0

i also experienced the same thing, but when i change JDK to 16 it managed to debugenter image description here

and it worked when changing my jdk

enter image description here

Kusuma
  • 1
0

I've tried a lot of things following different SO answers, but here's what worked for me at the end

I removed the JDK v11 I had initially (because from what I've read, 11 doesn't have the encryption algorithm), installed v16, then updated the JAVA version that gradle uses by going to:

Preferences > Build, Execution and Deployment > Build Tools > Gradle

then selecting Gradle SDK to v16

Dillion
  • 184
  • 8
0

Android Studio

1st :
Upgrade your Gradle Plugin Version
In order to do this you must get a gradle version downloaded.
You can get version 7.0.2 https://downloads.gradle-dn.com/distributions/gradle-7.0.2-bin.zip
then upgrade after in android studio.
You should get a popup notification to complete a gradle upgrade when
you open android studio again.
RESTART ANDROID STUDIO

2nd :
Inside project root open,
"file" -> "settings" -> "build, execution, deployment" -> "build tools" -> "gradle" Then update the Gradle user home
to your newly downloaded gradle location.
In my case I saved my download here - C:/Program Files/Android/gradle-7.0.2
RESTART ANDROID STUDIO

13garth
  • 655
  • 1
  • 8
  • 22
0

It seems to be an issue with different JDK versions as most people have pointed out. I had a similar issue. I encountered the issue with JDK 8, tried different flavours(Oracle, Adopt...) but finally worked when I upgraded the version to JDK 14.

Samuel Mutemi
  • 358
  • 3
  • 7