Hi, I’m using capacitor and after adding appflow SDK (“@capacitor/live-updates”: “^0.3.1”), my android build is giving Duplicate class org.bouncycastle.LICENSE error:
Duplicate class org.bouncycastle.crypto.generators.Argon2BytesGenerator found in modules bcprov-jdk15on-1.65 (org.bouncycastle:bcprov-jdk15on:1.65) and bcprov-jdk15to18-1.69 (org.bouncycastle:bcprov-jdk15to18:1.69)
Duplicate class org.bouncycastle.crypto.generators.Argon2BytesGenerator$1 found in modules bcprov-jdk15on-1.65 (org.bouncycastle:bcprov-jdk15on:1.65) and bcprov-jdk15to18-1.69 (org.bouncycastle:bcprov-jdk15to18:1.69)
Duplicate class org.bouncycastle.crypto.generators.Argon2BytesGenerator$Block found in modules bcprov-jdk15on-1.65 (org.bouncycastle:bcprov-jdk15on:1.65) and bcprov-jdk15to18-1.69 (org.bouncycastle:bcprov-jdk15to18:1.69)
Is there anyway to resolve this?? Thanks!
Can you share all the Capacitor plugins you have installed?
Looks like a conflict between plugin dependencies.
I found the conflict is with @capacitor-community/stripe. Is there anyway to resolve the conflict in my config?
Thanks!
You can force both libraries to use the newer bouncycastle release by adding something like this to your app’s build.gradle
file:
configurations.all {
c -> c.resolutionStrategy.eachDependency {
DependencyResolveDetails dependency ->
if (dependency.requested.group == 'org.bouncycastle' && (dependency.getTarget().name == 'bcprov-jdk15on' || dependency.getTarget().name == 'bcprov-jdk15to18')) {
dependency.useTarget 'org.bouncycastle:bcprov-jdk18on:1.79'
}
}
}
bcprov-jdk15on
is used by live-updates SDK that the @capacitor/live-updates
uses.
bcprov-jdk15to18
is used by sentry SDK that the @capacitor-community/stripe
uses.
Yep, I’ve run into that BouncyCastle duplicate class issue myself — it usually pops up when multiple dependencies include the same crypto provider. Best bet is to check your build.gradle files and explicitly exclude the conflicting version from one of the libraries, especially if both Appflow SDK and another plugin are bundling it.