Skip to content Skip to sidebar Skip to footer

How To Include An External Jar File To Aar File In Android

I want to develop a solution that allows me to use an external jar library in an SDK generated in aar file for an Android project. What I have as inputs : SDK : 'de.xx.sdk:xxx-andr

Solution 1:

You should try to put your jar into a module (File->New->New Module->Import JAR/AAR Package) and then add the module as a dependency.

Solution 2:

implementation('de.xx.sdk:xxx-android-v1.0.0') { include group: 'libs/xxxx-v1.0.0' }

You can't do it in this way.

Something like exclude group: 'com.google.guava', module: 'listenablefuture' is possible because you have an artifact with a pom file published in a maven repo. In the pom file there is the list of the transitive dependencies, and if there is a match with the group/module gradle is able to exclude it.

To achieve something similar, you have to publish the lib a in maven repo with a group/name (it can't be lib/....v1.0.0)

Solution 3:

I know this is quite old, but it might can help the others

can add this snippet to build.gradle

https://gist.github.com/stepio/824ef073447eb8d8d654f22d73f9f30b

Post a Comment for "How To Include An External Jar File To Aar File In Android"