Thursday, February 19, 2015

Android SDK and Maven project

Haven't found modern android.jar on mvnrepo (only some old from2012).

So to add android 19 to your maven project:


1st: Install android jars as dependencies to your local repo (~/.m2)

cd ${ANDROID_HOME}/platforms/android-19


$ mvn install:install-file -Dfile=android.jar \
  -DgroupId=com.google.android -DartifactId=android -Dversion=4.4.2

$ mvn install:install-file -Dfile=uiautomator.jar \
  -DgroupId=com.google.android -DartifactId=android-test \
  -Dversion=4.4.2 -Dpackaging=jar


2nd: Add dependencies to your pom.xml

<dependency>
    <groupId>com.google.android</groupId>
    <artifactId>android</artifactId>
    <version>4.4.2</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>com.google.android</groupId>
    <artifactId>android-test</artifactId>
    <version>4.4.2</version>
    <scope>test</scope>
</dependency>


Should be good to go!