13

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.

5 Answers5

18

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
fangzhzh
  • 2,172
  • 21
  • 25
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.

IAmCoder
  • 3,179
  • 2
  • 27
  • 49
1

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.

0

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

Parth
  • 19
  • 3
0

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

android.jetifier.blacklist=bcprov-jdk15on
android.enableJetifier=true
helvete
  • 2,455
  • 13
  • 33
  • 37