Transitive dependencies problem

I have a library .aar that I’m trying to include in my project.
I can compile but at run time the app crashes because the aar has some transitive dependencies (like dagger). I looked at the source code of the projects that generates this aar and the gradle script looks like this:

dependencies {

api 'org.eclipse.jetty:jetty-server:8.1.12.v20130726'
api 'org.eclipse.jetty:jetty-servlet:8.1.12.v20130726'
api 'org.eclipse.jetty:jetty-client:8.1.12.v20130726'
api 'org.slf4j:slf4j-jdk14:1.7.5'

api fileTree(include: ['*.jar'], dir: 'libs')
api 'com.squareup:otto:1.3.8'
api 'com.squareup.picasso:picasso:2.5.2'
api files('libs/netty.jar')
api files('libs/cling-support-2.1.1.jar')
api files('libs/cling-core-2.1.1.jar')
api files('libs/seamless-http-1.1.1.jar')
api files('libs/seamless-util-1.1.1.jar')
api files('libs/seamless-xml-1.1.1.jar')
api 'commons-io:commons-io:2.4'
api 'org.apache.commons:commons-lang3:3.4'
api files('libs/login-with-amazon-sdk.jar')
api 'androidx.palette:palette:1.0.0'
api 'com.kyleduo.switchbutton:library:1.2.9'

api 'com.squareup.retrofit:retrofit:1.9.0'
api 'com.squareup.okhttp:logging-interceptor:2.6.0'
//    implementation project(':cutekit')
api 'androidx.multidex:multidex:2.0.1'
api ''
api 'androidx.cardview:cardview:1.0.0'
api 'androidx.recyclerview:recyclerview:1.1.0'

// location play services
api ''

// dexter runtime permissions
api 'com.karumi:dexter:4.2.0'

api 'androidx.appcompat:appcompat:1.1.0'
api 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.core:core-ktx:1.3.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

api ''

api 'com.github.zcweng:switch-button:0.0.3@aar'

api 'androidx.constraintlayout:constraintlayout:1.1.3'

implementation project(path:':sdk_release:source')

//dependency added to implement idtm sdk
api 'io.reactivex.rxjava2:rxjava:2.1.0'
api 'io.reactivex.rxjava2:rxandroid:2.0.1'

//airbnb lotte animation
api ''

implementation ''
implementation '' // if you use 
annotationProcessor ''
annotationProcessor ''

implementation 'com.squareup.okhttp3:okhttp:4.2.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation 'com.squareup.retrofit2:converter-gson:2.7.0'

implementation ''

implementation ''

implementation 'com.github.danimahardhika:cafebar:1.3.1'

def work_version = "2.4.0"

// (Java only)
implementation "$work_version"


I don’t know how to fix runtime issues with my configuration.
My new module containing this aar is this:

artifacts.add(“default”, file(‘security.aar’))

In the modules where I need to use this aar I do this:

implementation project(path: ‘:security.aar’)

I chose the module approach because I thought it was possible to put all the dependencies of the security.aar in his own module because the app gradle file has already a lot of dependencies and I don’t want to keep on adding stuff in it. MAybe there is a cleaner and simpler wayt to achieve this? I’m exahusted.


1 Like