Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic publish Beta Android app to the Google Play store

I am looking for a method that I can use to automatically publish an application to both the alpha and beta testing streams on the Google Play store, from my CI server.

My CI setup is as follows:

  1. The Android app is written using Android Studio (using Eclipse really isn't an option for us).
  2. The build scripts are written in Rake, and run the Gradle tasks, as well as Calabash-Android tests.
  3. The build server is Teamcity 8+, that is currently hosted locally (though we could be moving across to Jenkins in the cloud).

Having scanned through stackoverflow for an answer to this question, the only one found is API to automatically upload apk to Google Play? the answer to this is however over a year old, and as we all know a year is a lifetime in software development, so I hope things may have improved some what.

I also have a sub-question, after publishing to these two streams, how long should it take for testers to see them in the store? I'm hearing 24 to 48 hours, which considering apps published to production only take a couple of hours seems a little odd.

like image 578
pauljriley Avatar asked May 02 '14 11:05

pauljriley


People also ask

How do I publish an Early Access app on Play Store?

So you have to create a public beta test and add your APK. Then it should show up as "early access" version. To help you in the early stages of development, Early Access offers a showcase on Google Play for selected new apps still in beta testing.

How do I publish an APK signed to Google Play?

In the menu bar, go to Build and select the option Generate Signed Bundle or APK. You will see a new popup screen where you will have two options to select, Android App Bundle and APK. The Android App Bundle is also used to upload the application to the Google Play Store we will talk about it later on.


2 Answers

Edit

The plugin below no longer works because Google shut down old versions of their API. Consider using Gradle Play Publisher instead.


Update: The plugin is now available as com.savillians.gradle:android-publisher:0.4 from maven central. Add it to your buildscripts definition in build.gradle and apply it as I stated below.

I had the exact same question, and thanks to @edovino's comment and the Google Play API samples, I was able to create a gradle plugin that does the publishing to any track you wish for any flavor/variant you wish.

See the sources here: https://github.com/bluesliverx/gradle-android-publisher

I'm working on publishing this to maven central so it can be used in a build script, but for now you can grab the android-publisher subdirectory in the repo, put it in the root of your gradle build, and rename the folder to buildSrc. Use the following line in the build.gradle file for the android project you want to publish:

apply plugin: com.savillians.gradle.androidpublisher.AndroidPublisherPlugin

You can then set your publishing settings using an androidPublisher block in the build.gradle file.

android {
    ...
}
androidPublisher {
    applicationName = "Company-Name-Product-Name/1.0"
    packageName = "<package name>"
    serviceAccountEmail = "<service account email>"
    serviceAccountKeyFile = file('<p12 keyfile - NOT the json file>')
    track = "alpha" // default, don't need to specify
    variantName = "release" // default, don't need to specify
}

Make sure the service account you create has "release manager" permissions, download the p12 key file and put it in the project's directory. Then run this command:

gradle androidPublish

That will send it to Google Play using the credentials you specified. Good luck and let me know if you have questions since this is brand new.

like image 144
bksaville Avatar answered Oct 21 '22 19:10

bksaville


If you're using Jenkins, the Google Play Android Publisher Plugin lets you automatically upload alpha or beta builds.

You can also use it to "promote" an APK from alpha, to beta, or from beta to a staged rollout, for example.

Multiple APK support and the ability to upload (or reuse) expansion files are included as well.

By integrating with the credentials functionality in Jenkins, the plugin can securely access your Google Play account(s) without having to check the private key in to the repository or similar.

like image 36
Christopher Orr Avatar answered Oct 21 '22 19:10

Christopher Orr