API to automatically upload apk to Google Play?
Solution 1
As of today there is a new official publishing API That allows you to upload to any channel (ie. alpha, beta...) or update title and description and more.
From the docs:
- Uploading new versions of an app Releasing apps, by assigning APKs to various Tracks (alpha, beta, staged rollout, or production)
- Creating and modifying Google Play Store listings, including
- localized text and graphics and multi-device screenshots
Look here for more info: https://developers.google.com/android-publisher/
Solution 2
gradle-play-publisher is a Gradle plugin to upload your APK and app details to the Google Play Store.
I simply run ./gradlew publishApkRelease
from my terminal and it uploads the APK and the summary of recent changes., there are more task like this available.
It uses the The Google Play Developer API
Solution 3
There is no official Google API for automating working with Google Play. (This is NOT true after July 2014)
You can create a script that encapsulates a web browser and simulates user bevahiour: find HTML fields, enter info there, submitting the page, etc.
We are working on such open-source Python tool: https://github.com/onepf/AppDF/tree/master/tools/uploader
Solution 4
I answered this also on this question, but I figured I'd add the same comment here. Let me know if that's the wrong way to do this (duplicating answers).
I was able to create a gradle plugin that does the publishing to any track you wish for any flavor/variant you wish using the new Google Play Publishing APIs.
See the sources here: https://github.com/bluesliverx/savillians-gradle
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.
Magnus
Updated on July 08, 2022Comments
-
Magnus almost 2 years
Is there any API or tool that enables me to automatically upload an APK to Google Play? I want to automatically publish customized apps to my account without any manual steps or graphical interface.
I searched around but could not find any API for doing this (only android-publisher but it doesn't support publishing, despite its name). Did anyone solve this already, seems like a basic feature?
-
Léo Lam almost 10 yearsThis was true until late July 2014, when Google added a publishing API. See the answer from sharshi for more info.
-
Léo Lam almost 10 yearsNote that the API is only for already published apps (that have at least one APK uploaded).
-
Vitalii over 9 yearsAuthorisation with Google might be a trick. Here's how getting token via command line would look. P.S. The .p12 key mention there will not work until you convert it yo .pem with the command "openssl pkcs12 -in my_google_key.p12 -out my_google_key.pem -nodes -clcert"
-
Vitalii over 9 yearsUPDATE: Unfortunately as of today the main API command Edits: insert results in error messages of different kind with no solutions yet
-
Richard Le Mesurier over 9 yearsThis answer is now wrong.
-
Sankar V over 9 yearshave a look with this gradle plugin - github.com/Triple-T/gradle-play-publisher
-
Ricardo Pedroni over 9 yearsDoes anyone know if the restriction of updating only preexistent apps still apply?
-
ApiFox about 9 yearsit looks like at this moment there is no way to upload new apks via AndroidPublisher API, only updates accepted?!
-
Nevin Raj Victor about 9 yearsplease find stackoverflow.com/questions/29816342/… Does
gradle androidPublish
generate the signed apk and upload to playstore -
bksaville about 9 yearsAnswered. This plugin will do what you are looking for.
-
Léo Lam about 9 years@RicardoPedroni Yes, the limitation still applies.
-
Aqib Mumtaz almost 9 yearsHi, Im new to Gradle, gradle-play-publisher says "Once you have applied this plugin to your android application project you can configure it via the play block", Where I need to add play block?
-
Carlo Espino almost 9 yearsIn your
build.gradle
file -
Aqib Mumtaz almost 9 yearsCould you please share your build file? Im constantly getting this exception "org.gradle.execution.TaskSelectionException: Task 'publishApkRelease' not found in root project"
-
Aqib Mumtaz almost 9 yearsI have posted my question stackoverflow.com/questions/31449533/…
-
Dokuzov almost 8 yearsSo it is still for already uploaded APKs?You cannot upload first version of an app through the API?
-
sharshi almost 8 years@Dokuzov yes only updates
-
oldergod over 7 yearsnot really active project anyhow
-
Carlo Espino almost 7 yearsWhy you say is not an active project?
-
Sajith Vijesekara over 6 yearshi @bksaville is this plugin support for existing apps. Can't we use for newly created apps.
-
Maks over 5 yearsI found that instead of "release manager" for the Roles when creating the service account I needed to instead: in the Role dropdown choose "Service Accounts" -> "Service Account User" and "Service Account Token Creator"
-
sathya over 5 yearsAny API limit for access this google play store publish API? @sharshi
-
Jay Kukadiya almost 3 yearsis this api are free to use?