Fork me on GitHub

Publishing with the Google Play Developer API

Maven Publisher

With help of the Google Play Developer API it is now possible to automatically publish APKs, update store listings, etc.

A Gradle plugin for this was already created on which we based the Maven Mojo’s.

At the moment there are Mojo’s for uploading APKs and updating the store listing including screen shots, feature graphics etc. Both can be used inside a project or in a stand alone fashion, but in both cases you need the publisher email and a p12 key file. How to obtain these can be found here.

It is possible to pass the email and key file as arguments in the command line but the preferred way is to setup a profile in settings.xml:

<profile>
  <id>publisher</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
    <properties>
        <android.publisher.google.email>publisher email</android.publisher.google.email>
        <android.publisher.google.p12>path to p12 key file</android.publisher.google.p12>
    </properties>
</profile>

If you want to use the publisher outside of a project, you will need to supply the other required values:

<android.publisher.apkpath>path to APK</android.publisher.apkpath>
<android.publisher.project.name>project title</android.publisher.project.name>
<android.publisher.listing.directory>path to listing directory</android.publisher.listing.directory>
<android.publisher.package.name>project package name</android.publisher.package.name>

Again these can be supplied in the commandline or added to the profile.

To update the listing comply to the following structure:

- [src]
  + - [main]
      + - [play]
          + - [en-US]
          |   + - [listing]
          |   |   + - fulldescription.txt
          |   |   + - shortdescription.txt
          |   |   + - title.txt
          |   + - whatsnew.txt
          + - [de-DE]
              + - [listing]
              |   + - fulldescription.txt
              |   + - shortdescription.txt
              |   + - title.txt
              + - whatsnew.txt
Note
The text files are the default values, which can be changed by setting the corresponding parameters. For example android.publisher.filename.whatsnew=newinversion2.xml

If you want to update images in the listing as well, set the following attribute to true:

<android.publisher.upload.images>true</android.publisher.upload.images>

And comply to the structure:

- [src]
  + - [main]
      + - [play]
          + - [en-US]
              + - [listing]
                  + - [featureGraphic]
                  + - [icon]
                  + - [phoneScreenshots]
                  + - [promoGraphic]
                  + - [sevenInchScreenshots]
                  + - [tenInchScreenshots]
Note
This structure is the same as the one used in the Gradle plugin, so both plugins can be used if this structure is followed.

Examples

To upload an APK to the Play store, use the following command

mvn android:publish-apk -Ppublisher

To update the store listing with new images

mvn android:publish-listing -Ppublisher -Dandroid.publisher.upload.images=true
Note
By default the APK will be uploaded to the alpha track in the Play store, to change this set the android.publisher.track parameter (see Tracks).