Search code examples
androidbouncycastleandroid-security

NoClassDefFoundError: BouncyCastleProvider


I have an interesting problem on a specific Android version. So I include BouncyCastle dependency in Gradle like this:

compile 'com.madgag.spongycastle:prov:1.51.0.0' 

and initialize security provider like this:

import org.spongycastle.jce.provider.BouncyCastleProvider;

...
public void initializeSecurity() {
    Security.addProvider(new BouncyCastleProvider());
}
...

My IDE autocompletes the code related to bouncycastle and on my Nexus 5 everything work just fine. But the problem is that on Samsung GT-I8200N the app crashes with an error:

java.lang.NoClassDefFoundError: org.spongycastle.jce.provider.BouncyCastleProvider

Also I set up the emulator mimicking the Samsung device - API 17 ARM7-a. Same error.

Anybody had a similar problem before?


Solution

  • Sorry, I just messed up my multidex setup. So if anyone will encounter similar problems check if multidex is set up correctly.