3

I'm making an Android Library which I need to share with some clients. This library includes some .jar libraries which are private and which I can't share. These are in a private maven repo which is used in the Android library.

When I compile the aar I want these remote private maven repos to be downloaded and included in the aar like in an apk.

By adding these jars to the lib folder I get the desired effect. This however adds more labour on our part and makes a mess of keeping these libraries up to date through out all our projects.

This question has been asked before like here & here. Its 2017 and feels like quite a vital option. Does anyone know of a work around to force gradle and android studio to include remote dependencies which an .aar can't live without?

Community
  • 1
  • 1
just_user
  • 11,769
  • 19
  • 90
  • 135

1 Answers1

0

As you described in the question, you can add the jar files in the libs folder. Hovewer it means that this libraries are included in the aar and you can't update them without update the aar.

The only other solution is to give access to the private repository to the private libraries, also with an authenticated access.

Of course who is using the aar, have to add in the gradle file the repo url with the credentials.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • True, but these are the two options I'm trying to avoid. But as they are the only ones at the moment I have to go with one. I still hope that this option will be added to android-studio in the future. – just_user Mar 21 '17 at 08:53
  • @just_user I don't think that it is an Android Studio lack. It is related to the build system (gradle and maven repo) and all dependencies work in this way. The pom file doesn't cointain any info about the repository then the only way is to add the additional repo in the build.gradle. Of course I suggest you using a private repo with authenticated access. In this way only authenticated users can use your private jars. – Gabriele Mariotti Mar 21 '17 at 08:59