0

From what I can tell there are two main ways to add a library project to your Android Studio project that is not in the maven repo. Both can actually be seen here. I am aware that doing it the module way is the Intellij way to do it (importing project to your modules and adding it as a dependency). It works quite nicely. But then there is the accepted answer way in the link above (copy and pasting the whole project in a library folder and adding it through gradle). Is doing it either way accomplishing the same thing in the "back" so the speak, or is there actually a difference? Is one way more preferred?

My reason for asking this is because I keep seeing both ways. On the one hand, since Android Studio is based on Intellij, the way Intellij does it makes sense. In fact the Android docs basically takes this behavior. On the other, the switch to Gradle isn't a bad way, although not as easy to understand.

Community
  • 1
  • 1
Andy
  • 10,553
  • 21
  • 75
  • 125

1 Answers1

0

First, I'd suggest looking for the library in more than one Maven repository. The fact that the dependency is not in Maven Central doesn't mean it can't be found in JCenter, for example (more and more Android libraries authors publish to JCenter only since jcenter() is configured by default in Android Studio and publishing to Maven Central is a huge PITA).

But let's assume the dependency can't be found in any public Maven repo.

Both ways you mentioned are suboptimal. Checking the lib folder to a source really bad idea. Source control, as the name implies is for sources.

With excellent and free Binary Repository Managers out there it's really easy to 'mavenize' all your dependencies and use them correctly.

If you don't want to manage Binary Repository server, you still have at least two options:

  1. You can use Artifactory SaaS offering.
  2. Publish the dependency to your own repository in Bintray and then use if from Gradle. That probably will be the easiest the the most correct way to deal with the problem.
JBaruch
  • 22,610
  • 5
  • 62
  • 90