How to upload an APK from Jenkins/Hudson to Play Store?

11,184

Solution 1

There is a Google Play Android Publisher plugin for Jenkins which uses the Google Play Publishing API, announced at Google I/O 2014.

Google has also released Java and Python libraries to help make use of the API.

For more info on the API, see also:
http://android-developers.blogspot.com/2014/07/grow-with-google-play-scaled-publishing.html

Solution 2

I can talk only for Google's Play Store. There is a way, but be warned, it isn't beautiful, you have to code your solution. I am right now writing a Bachelor Thesis to solve this problem - "Continuous Delivery for Android Applications". My solution is mine, this means I don't raise a claim to have the perfect solution, but I can say it is quite working prototype.

I found out the following:

  • The first Solution is none. Google offers an Play Store API, but it lacks to upload stuff. Seems that they were already thinking about to make such an API, but it only offers In-App billing control

  • The 2nd solution is to use Apache HttpComponents Library, which lets you implement your own Client for the Google Play Developer Console, but HttpClient lacks a JavaScript Interpreter... Several ways to implement or add one. But of course, not the easiest way.

  • The 3rd Solution I am working on, is to use Selenium Web Browser Automation Framework. So basically I create PageObjects from those Play Store Pages and dialogues. After that you can create some Factory to maintain "pathes" of controlling these PageObjects.

Using them you have two options as far as I can see, for instance the WebDriver Objects which uses an "invisible" browser process like FF or Chrome and another I use is ChromeDriver which uses a visible Browser process, to perform the User actions. And don't forget to have Exception Handlers, which scans the Webpage for appearing errors, while in use.

There are a lot of pitfalls, due to possible changes in the Design from Google, which lets your Software break. But there are also some ways to handle that. =) And create an XML containing all valueable information about an app, which comes in handy, when continueing to the next step.

You can create a Maven Plugin. This you can load into your Continuous Integration Server. I hope I could help you a bit.

Solution 3

Since Google Play released the upload API, a plugin has been made:

https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=73533143

I haven't tried it yet, but looks like it's exactly what we were looking for.

There are other plugins that claim to do the same (thanks @mdt)

Solution 4

I believe it is not included in the PlayStore API currently to reduce stress on the system and to avoid abuse.

I believe we may see this in the gradle plugin and in the IDE in the future. While we wait for google decide to open up the API, here is a solution, that is so sill, that i just had to propose it:

If you have a GUI, use GUI automation for the last step.

Solution 5

Google Play Android Publisher plugin for Jenkins is a good one. However, it doesn't support uploading descriptions and screenshots (at least for now).

I found decent Gradle plugin, called Gradle Play Publisher. It supports uploading apk, updating Metadata, and uploading screenshots. And it only needs a few steps to setup.

Share:
11,184

Related videos on Youtube

mdt
Author by

mdt

Working as employed software engineer and as freelance contractor and provider in spare time. Love Jesus, my family, and doing fun stuff (like coding) - in that order. PLEASE DON'T SEND ME JOB OFFERS.

Updated on June 10, 2022

Comments

  • mdt
    mdt about 2 years

    I implemented a continuous integration pipeline using Jenkins, but as final step I want Jenkins to deploy/upload the signed APK file to Google Play Store and AndroidPit. I looked for Jenkins/Hudson plugins but only found two: one for Appaloosa and one for Zubhium.

    I have a working developer account both on Google Play and on AndroidPit and can manually upload the APK that Jenkins produces. But my question is: Does anybody know a way to teach Jenkins (e.g. via a shell script?) to upload the APK to the mentioned app stores?

    • mdt
      mdt over 11 years
      I inquired at Google and they answered that this feature is not available for the Play Store. Does anyone have an idea?
    • Etienne Savard
      Etienne Savard almost 10 years
      Quick update if someone is looking for a solution to this. The latest release of the Google Play Developer API allows now to push changes to Google Play listing. See : developers.google.com/android-publisher/api-ref
  • philipp
    philipp over 11 years
    oh that sounds painful and really dirt :) How does your thesis like the new developer portal? :)
  • Semo
    Semo over 11 years
    @philipp, sorry, I didn't understand what you mean. How can my thesis like something? Is that an english saying, because as German I am pretty unversed in a lot of english sayings... :-) Is this saying a kind of this one: "How is London like?"? And please which developer portal do you mean? Best regards.
  • philipp
    philipp over 11 years
    Es war als witz gemeint, wie es deiner Arbeit das neue Google Developer Portal gefaellt, da Google gerade alles umgestellt hat. Wenn du einen Scraper geschrieben hast, wird der bald nicht mehr funktionieren. lg
  • Semo
    Semo over 11 years
    @Philipp OK. Got it. In der Arbeit nutzte ich das neue Layout. Momentan geht alles. Ich nutze den Kniff der PageObjects mit relativen Suchmustern, um WebElements zu identifizieren. :)
  • philipp
    philipp over 11 years
    is your script able to upload screenshots in bulk in all the languages and also update descriptions. I would love that, and still upload the APK my self.
  • Semo
    Semo over 11 years
    @philipp Yes it is. And it is no script, but plain Java code. The problem with it, is to get a notification, when the upload process is complete, from the Google Play Developer console. The upload process and control of different languages is done by sequential use of Selenium Tasks. That is why I created 'pathes', the way how you can use the Play Console. I am working to refine that, by using an 'Build'-XML containing the tasks, images, languages and so on. It shall work like maven, when it handles everything to do while a build is made...
  • philipp
    philipp over 11 years
    I would be really interested in that. Can you email me at firstname [at] getkeepsafe.com
  • kstep
    kstep almost 11 years
    Just a thought. The console uses AJAX requests to do things. I looked at requests the console's page makes, and noticed all of them are POST requests with JSON objects {"method":...,"params":...,"xsrf":...} and server reply is {"result":...,"xsrf":...}. While it needs more research, I think one can reverse engineer this console's private API and write a wrapper around it. The first thing to do on the way is find out the way authorization works (they use cookies as far as I can see), and then it should be just tedious work to do, no browser emulator with JS involved, just plain HTTP requests.
  • Semo
    Semo almost 11 years
    @kstep so true. The cookies and the connection to the JS is well encrypted and obfuscated. Unfortunately I have a lack of time to solve this problem. Do you know a more direct way including a solution? By the way - your suggestion is what I tried first... :-)
  • shalafi
    shalafi almost 10 years
    This is the good answer now that google has published the API
  • Marta Rodriguez
    Marta Rodriguez almost 10 years
    I have published a Gist based on google's python script to upload an apk without user interaction. Now you can execute this script through Jenkins command shell plugin: gist.github.com/marta-rodriguez/20b8684e76fb1262576e
  • mdt
    mdt almost 10 years
    I won't try it yet, as there are at least two plugins that claim to do the same. Let's give the developers some time, but it looks promising!
  • shalafi
    shalafi almost 10 years
    haven't seen the other 2. It would be interesting to edit the answer with the different options.
  • mdt
    mdt almost 10 years
    OK, I included the plugins I found above.