Include an extra library from Maven into an Android Project

To include an extra dependency into an Android project we need to:

  1. Go to file and select “Project Structure”:
    Android studio file project structure
  2. Next step it is to select the app section and then the Dependencies tap.
    Open the app tap
  3. At this point we click on the plus sign at the bottom of the window and then we select add library dependency:
    Add library dependency
  4. The last step it is to add the dependency we’re looking for, in my case it is to include the apache commons, so I search for and I select on the package I am interested to and click OK.
    Add external library dependency into project android studio

Converting a Maven Project to a Gradle one

Working with Android Studio means that we need to use gradle projects, however it might happen that some of our old projects were made in pure Java and with Maven, this is actually quite likely.
Converting a project from one format to another is though quite easy to be done through the command line and the built init plugin.
In particular this tool allows us to convert not just from Maven but also from grails, java and scala.
Anyway, to move from Maven to gradle we just need to:

cd project
gradle init --type pom

At this point we can import the project into Android Studio quite easily.

Adding Maven to a project in IntelliJ

Previously I used the jar libraries for the Selenium/Selendroid project to work fine, however the method is not really ideal. Project dependencies should be imported automatically with a dependency sistem of some sort. Here I am going to add Maven to the project and manage the dependenices through it. Here I am going to add selenium-java and selendroid-standalone, but this is of course valid for any other library.
Continue reading Adding Maven to a project in IntelliJ