0

There are some options to add lib to project

  1. I can add dependency to gradle

  2. I can add lib to lib dir and set as a lib

  3. I can add module to my project

But this ways it is not exactly what I need. I am looking to option to add path to external dir(lib) on my PC that my android project can use it... The same like you set path to ndk or sdk ... You don't copy this libs to your project you just set a path to them and android studio knows how to compile it and you can use it, right?

So, it is means that a lot of projects can look (set path) at the same dir (ndk, sdk) and use it... And if you will delete this dirs (ndk, sdk) from your PC none of the projects will compile...

So, I am looking the same way and question is if is it possible to set path to my dir (like ndk, sdk) and use it. I don't want to copy source code to each project...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sirop4ik
  • 4,543
  • 2
  • 54
  • 121
  • what is grande, i thought of grenade at first – Manoj Perumarath Jul 18 '19 at 11:13
  • @ManojPerumarath typo...gradle – Sirop4ik Jul 18 '19 at 11:14
  • Do you want to import a local jar like in [this question and its answers](https://stackoverflow.com/questions/20700053/how-to-add-local-jar-file-dependency-to-build-gradle-file)? – deHaar Jul 18 '19 at 11:18
  • @deHaar no, you are talking about second option that I described in my question... It is means that you should add this lib to your project... So, you should really copy paste it ... I don't need to copy paste, I need the way just set a path – Sirop4ik Jul 18 '19 at 11:25
  • There's a way by using a local Maven repo. You publish your lib or *.AAR to the local repo and then tell Gradle to get the dependency from there. I found [this tutorial](https://alessiobianchi.eu/blog/obfuscated-aar-local-maven/) with a quick search. There may be better ones. – Markus Kauppinen Jul 18 '19 at 12:39

1 Answers1

0

You could create a module from the code you want to re-use and add it to all the projects you want to use it in.