Gaurav Singh Tanwar
Gaurav Singh Tanwar

Reputation: 171

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

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.

Upvotes: 16

Views: 14047

Answers (5)

Adnan Jafar
Adnan Jafar

Reputation: 59

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

android.jetifier.blacklist=bcprov-jdk15on
android.enableJetifier=true

Upvotes: 1

Parth
Parth

Reputation: 51

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

Upvotes: 0

Muhammad Javed
Muhammad Javed

Reputation: 119

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.

Upvotes: 2

fangzhzh
fangzhzh

Reputation: 2252

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

Upvotes: 20

IAmCoder
IAmCoder

Reputation: 3442

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.

Upvotes: 7

Related Questions