Skip to main content
  1. All Posts/

maven-android-sdk-deployer

Tools Shell

Maven Android SDK Deployer


Original author including numerous fixes and changes:
Manfred Moser manfred@simpligility.com at simpligility technologies inc
Project maintainers:

Contributors (historical order..):

  • Hugo Josefson hugo@josefson.org – properties plugin usage
  • Jake Wharton jakewharton@gmail.com – 3.2, compatibility v13 and 4.0.3 support
  • https://github.com/holdensmagicalunicorn – spelling fix
  • Guto Maia guto@guto.net- initial USB add on support
  • Lorenzo Villani – initial 4.0 support
  • Paul Merlin http://eskatos.github.com – Google Analytics extra
  • Matteo Panella morpheus@level28.org – Google AdMobs extra, support for 4.1
  • Benoit Billington https://github.com/Shusshu Google Cloud Messaging Client and Server, annotations.jar, 4.2, 4.3, 4.4, APK Expansion, Licensing, 4.4W, L, 5.0, MultiDex, MNC
  • Michael Lake https://github.com/mlake support for Javadoc attachment for platforms
  • Nic Strong http://www.codepoets.co.nz Google Play Services (gms)
  • Matias Dumrauf http://github.com/mdumrauf – Compatibility v7 library support, Google Analytics support for V1 and V2
  • https://github.com/skyisle minor documentation fix
  • Viacheslav Rodionov https://github.com/bepcyc AdbMob update
  • David Venable https://github.com/dlvenable admob update
  • Jenny Loomis Williamson https://github.com/jloomis fix for deployment
  • James Wald https://github.com/jameswald configured groupId and artifactId for support libraries
  • Thomas Prochazka https://github.com/tprochazka javadoc attachment, fix for artifactIds
  • Shairon Toledo http://www.hashcode.eti.br doc update
  • Kohsuke Kawaguchi http://kohsuke.org/ webdav support for deployment
  • Lars Hoss http://cv.woeye.net/ v7 appcompat library support
  • Nemanja Nedic https://github.com/nemanjanedic appcompat javadoc fix
  • Yuvi Panda https://github.com/yuvipanda appcompat fix
  • Sebastian Roth https://github.com/ened added missing google-apis-18 add-on
  • Andreas Gawelczyk https://github.com/andreas- – Compatibility v7 mediarouter
  • Hoyt Summers Pittman https://github.com/secondsun – Google API 19, google play services to > Froyo, update android-maven-plugin
  • Aaron Alaniz https://github.com/aaalaniz – Google Glass Development Kit
  • Heath Borders https://github.com/hborders – documentation update
  • Hoyt Summers Pittman https://github.com/secondsun – javadoc fix for Java 8 support
  • Dieter Adriaenssens https://github.com/ruleant
  • Quentin Rousseau https://github.com/kwent
  • Mingfai Ma https://github.com/mingfai
  • Raphael Ackermann https://github.com/rtack sdk 21 fix for apklibs
  • Daniel Passos https://github.com/danielpassos – Google API 24
  • Edda Björk Konráðsdóttir, Android 7.1 API 25
  • Alexander Berezovsky https://github.com/alezandr – Android API 15 & 25 sources
  • Alix Warnke, Android 8.0 API 26
  • Zsolt Fatér, https://github.com/zsoltii – Android 8.1 API 27, Android 9.0 API 28, adding repositories/extras-m2repository, fixes for add-ons

The Maven Android SDK Deployer is a helper maven project that can be
used to install the libraries necessary to build Android applications
with Maven and the Android Maven Plugin directly from your local
Android SDK installation.
The dependencies can also be used from other build tools such as Gradle, Ant/Ivy or SBT.
ATTENTION! Currently some android.jar artifacts are available in
Maven central and unless you use maps or usb related dependencies,
android 3.0+, the compatibility library jar files or insist on using
the original jar files from the local SDK install, you might not need
this tool anymore.
You will however need this tool to access the latest Android 4.2
release or to work around bugs like missing JSON libraries in some
older artifacts deployed to Maven central. If you use this tool make
sure your dependencies are as documented here.
The android.jar artifacts in Maven central are available with the
groupId com.google.android, whereas this tool uses groupId android to
avoid overlap.

How to Use

Download the latest Android SDK from
http://developer.android.com/sdk/index.html following the instructions
there.
Apache Maven 3.1.1 or higher is required!

  • For the default usage of the deployer install all platforms and
    add-on apis
    , ensure that all folder in the platforms folder have
    names like android-3, android-4 and so on.
  • If you find names using the platform version (e.g. 15) in the folder
    name reinstall that platform from the android tool.
  • In a similar manner the folder names in add-ons have to use the
    pattern addon-google_apis-google-3 up to addon-google_apis-google-15.
  • If the folder names are different reinstall the add-ons as well

Set up the environment variable ANDROID_HOME to contain the absolute
folder you just installed the SDK to (e.g. under bash: export
ANDROID_HOME=/opt/android_sdk_linux) and ensure that the folder for
ANDROID_HOME and all files within are readable by the current user
Run the command

mvn install

in the root folder of this project (same as README you are just
reading) to install all platforms and add-on apis
To install only a certain sdk level use

mvn install -P 2.1
mvn install -P 2.2
mvn install -P 2.3.3
mvn install -P 3.0
mvn install -P 3.1
mvn install -P 3.2
mvn install -P 4.0
mvn install -P 4.0.3
mvn install -P 4.1
mvn install -P 4.2
mvn install -P 4.3
mvn install -P 4.4
mvn install -P 4.4W
mvn install -P 5.0
mvn install -P 5.1
mvn install -P 6.0
mvn install -P 7.0
mvn install -P 7.1
mvn install -P 8.0
mvn install -P 8.1
mvn install -P 9.0
mvn install -P MNC

As a result you should find the android.jar and maps.jar and a number of other
libraries in your users local repository (~/.m2/repository/) and you can therefore
use the following dependencies in your project
For the core platforms providing the Android API use

<dependency>
  <groupId>android</groupId>
  <artifactId>android</artifactId>
  <version>x.y.z</version>
  <scope>provided</scope>
</dependency>

with versions of

<version>2.1_r3</version>
  <version>2.2_r3</version>
  <version>2.3.3_r2</version>
  <version>3.0_r2</version>
  <version>3.1_r3</version>
  <version>3.2_r1</version>
  <version>4.0_r4</version>
  <version>4.0.3_r5</version>
  <version>4.1.2_r5</version>
  <version>4.2.2_r3</version>
  <version>4.3.1_r3</version>
  <version>4.4.2_r4</version>
  <version>4.4W.2_r2</version>
  <version>5.0_r2</version>
  <version>5.1_r1</version>
  <version>6.0_r3</version>
  <version>7.0_r2</version>
  <version>7.1.1_r3</version>
  <version>8.0.0_r2</version>
  <version>8.1.0_r3</version>
  <version>9_r6</version>

For the maps add ons use a dependency

<dependency>
  <groupId>com.google.android.maps</groupId>
  <artifactId>maps</artifactId>
  <version>x.y.z</version>
  <scope>provided</scope>
</dependency>

with versions of 7_r1, 8_r2, 11_r1, 12_r1,
13_r1, 14_r2, 15_r2, 16_r3, 17_r3, 18_r3, 19_r10, 21_r1
For the usb add on

<dependency>
  <groupId>com.android.future</groupId>
  <artifactId>usb</artifactId>
  <version>x.y.z</version>
  <scope>provided</scope>
</dependency>

with versions of 10_r2, 12_r1, 13_r1, 14_r2, 15_r2, 16_r3, 17_r3,
18_r3, 19_r4, 21_r1
Android SDK Maven Repositories
The Maven repositories from the Android SDK for Google and Android are copied to the local repository or uploaded to
a remote repository manager just like they are in the SDK and contain all components from these repositories.
Currently they are in the package space com.android.support and com.google.android and present the preferred components
for usage. Specifically the various compatibility and support libraries as Android Archives:

<dependency>
  <groupId>com.android.support</groupId>
  <artifactId>appcompat-v7</artifactId>
  <version>x.y.z</version>
  <type>aar</type>
</dependency>

with versions 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3

<dependency>
  <groupId>com.android.support</groupId>
  <artifactId>cardview-v7</artifactId>
  <version>x.y.z</version>
  <type>aar</type>
</dependency>

with versions 21.0.0, 21.0.2,…