Errors while building APK: Algorithm HmacPBESHA256 not available
Asked Answered
P

7

9

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

Potion answered 7/5, 2021 at 15:39 Comment(5)
This is problem in Java that could not find encryption algorithm. Its support was added in Java 12. See similar discussion: https://mcmap.net/q/508163/-algorithm-hmacpbesha256-not-availableWarmup
@Kuzneц I am using Java 16, But still getting this error. Am I missing anything else?Wallas
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: #19609242Warmup
This works fine for me guys :) https://mcmap.net/q/265556/-error-building-aab-flutter-android-integrity-check-failed-java-security-nosuchalgorithmexception-algorithm-hmacpbesha256-not-availableSelffulfillment
This works fine for me guys :) https://mcmap.net/q/265556/-error-building-aab-flutter-android-integrity-check-failed-java-security-nosuchalgorithmexception-algorithm-hmacpbesha256-not-availableSelffulfillment
R
10

Make sure JDK is installed.

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

Rosol answered 26/10, 2021 at 7:42 Comment(0)
M
6

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.

Morello answered 29/7, 2021 at 18:16 Comment(1)
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.Gokey
I
2

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

Impound answered 13/2, 2022 at 13:53 Comment(1)
how to find an appropriate jdk versionInstal
K
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

Karisakarissa answered 24/11, 2021 at 8:47 Comment(0)
T
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

Taproom answered 8/12, 2021 at 12:30 Comment(0)
C
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

Cogitable answered 12/1, 2022 at 11:50 Comment(0)
C
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.

Corbicula answered 17/6, 2022 at 11:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.