BouncyCastle: Android: Unsupported class file major version 59. Failed to transform bcprov-jdk15on-1.67.jar (org.bouncycastle:bcprov-jdk15on:1.67)
Asked Answered
C

5

16

I want to use BouncyCastle for GnuPG encryption (want to get .gpg file) in android. But I am getting this error.(Unsupported class file major version 59.
Failed to transform bcprov-jdk15on-1.67.jar (org.bouncycastle:bcprov-jdk15on:1.67) )

My gradle version is: gradle-6.7.1-bin.zip
JAVA_VERSION="1.8.0_242"

Please help.
Or if somebody can suggest me some other way to do GnuPG encryption in android, that will also be very helpful.

Coarse answered 7/12, 2020 at 13:50 Comment(0)
B
20

Following these two links:

https://github.com/bcgit/bc-java/issues/762

https://issuetracker.google.com/issues/172784894?pli=1

A workaround is adding below line into gradle.properties

android.jetifier.blacklist=bcprov-jdk15on
Bride answered 31/8, 2021 at 21:26 Comment(0)
D
7

If you downgrade to bcprov-jdk15on-1.65 it still works with Android. From bcprov-jdk15on-1.66 Java 16 (major version 59) is require which Android Studio does not support.

You can also use jdk15to18: bcprov-jdk15to18-167.jar.

Duggins answered 4/2, 2021 at 11:47 Comment(0)
D
2

I'm also facing the same issue in my project. Issue resolved after adding

android.jetifier.blacklist=bcprov-jdk15on

in gradle.properties at app level.

Dishtowel answered 8/10, 2022 at 12:52 Comment(0)
U
1

I have faced same issue. first you open your build.properties and then add this

android.jetifier.blacklist=bcprov-jdk15on
android.enableJetifier=true
Ulceration answered 18/1, 2023 at 21:40 Comment(0)
S
0

I faced same issue. I fixed by deselect NDK (Side by Side) and rebuild! enter image description here

Shepp answered 17/10, 2022 at 10:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.