Daryn
Daryn

Reputation: 1609

Exclude Dependency Gradle

I have a problem of conflicting dependencies.

The two jars are:

Which both seem to be loading different versions of the same dependency: org.bouncycastle.

I can't seem to get it to work no matter what I try.

Have been trying something like this:

configure(globalModule) {

dependencies {
    compile('net.sf.jasperreports:jasperreports:6.4.1')
    compile('com.lowagie:itext:2.1.7') {
       exclude group: 'org.bouncycastle'
    }
    compile('com.connectifier.xero:client:0.13') {
       exclude group: 'org.bouncycastle'
    }
}

The error I keep getting is:

SecurityException: class "org.bouncycastle.asn1.pkcs.RSAPublicKey"'s signer information does not match signer information of other classes in the same package

The app will run fine if I do not import JasperReports, but I definitely need this.

Upvotes: 4

Views: 5774

Answers (1)

Daryn
Daryn

Reputation: 1609

I have resolved it! The normal method of exclude in gradle was not working and the workaround was as follows:

configure(globalModule) {
    dependencies {
        compile('net.sf.jasperreports:jasperreports:6.4.1')
        compile('com.connectifier.xero:client:0.13')    
        compile('com.lowagie:itext:2.1.7')    
    }   

    configurations {
        compile {
            exclude group: 'org.bouncycastle'
            exclude module: 'bcprov-jdk14'
        }
    }
    task enhance(type: CubaEnhancing)   

}

Upvotes: 5

Related Questions