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:
The Android app is written using Android Studio (using Eclipse really isn't an option for us).
The build scripts are written in Rake, and run the Gradle tasks, as well as Calabash-Android tests.
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.
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.
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.
There is now a straight forward CLI tool you can call in a build server build step:
https://github.com/codebysd/java-play-store-uploader
It uses google publisher API and uses the new JSON key format.
Related
I have one android app (e.g MyApp) in the Google Play Store, and at the moment the package is from the RC build in our pipeline, but we also want to publish package from CI build for testers. Is it better to create a new app called MyAppTest in play store which receives the package from CI build? Or is it better to just upload the package from CI build to "MyApp" under internal testing track? In the package from RC build, the version is like 1.0.0-RC1, and the package from CI build the version is like 1.1.0.1.
What is the best practice for this problem?
You should keep all into a single project! And use the different levels of testing of google play (alpha, closed beta, open beta).
Usually there are some levels of testing:
Internal testing (Release Candidates)
Open Beta for selected users
You should try to scale the same version from internal, to open beta to production. Most versions will be transitory, and won't reach production at all.
But you should keep the semantic versions all the way, some devs like to add -RC or -beta after the version to name, to tag as "in testing" version.
Am having a bad time with android in order to create new release
i have created a Signed APK with two option
then i zipped the .apk file,after trying to upload it to google console am getting the below error
Your Instant App APKs do not declare a valid 'android:targetSandboxVersion' attribute in their AndroidManifest. Using the 'com.android.feature' Gradle plugin to build your Instant App would add this attribute automatically.
Note : the file zipped and all the solutions asking to zip the file, no luck :(
You need to be clear if you are producing an Instant App or a normal Android app. I think this is what is confusing you, or maybe you just aren't being clear in the question.
Android Instant Apps are special Android apps that launch from a web page, and don't need a user to install them. To build them you need the Instant Apps SDK, and to follow the development instructions here. Android Studio will produce a zip for you, you don't need to do it manually
For normal Android apps, you don't need to zip your APKs. Just upload the APK itself to the Play Console.
I think you are probably making a normal Android app, but because you are zipping it, the Play console thinks you are uploading an instant app. So stopping Zipping your APK, and just upload it to the Play Console as a ".apk" file.
While you are at it, I'd recommend using APK V2 signing - it gives much faster installation on modern devices.
I published the wrong update for an app on the play store by the new Play Developer Console.
I need to rollback my update, simply REMOVING it and re-publishing the previous version.
I cannot understand 2 things:
how remove it from the apps versions menu
re-publish the previous one
In previous versions of Google Developer Console this could be possible unpublising the last .apk and enable to production your desired version
but now it can´t be possible.
Note that rollbacks aren’t supported due to the app versioning requirements of the Android platform. If you need to rollback, consider launching a previous APK with a new version number. However, this practice should be used only as a last resort, as users will lose access to new features and your old app may not be forward-compatible with your server changes or data formats, so be sure to run alpha and beta tests of your updates.
You can see the previous releases but you can´t enable again:
You need to create and publish a new release with a consecutive versionCode.
Click on Create Release Like you release a new version, but instead of uploading an apk click "Add From Library", Here you will get all the previous versions of your app, select the version you want to rollback to, then release it after review button.
Just build old app version with new versionCode and old versionName and publish it
Reviving this but for those that are looking for something similar but for Android App Bundles.
As it's not as clear cut as when doing it for .apk.
For .aab's you need to:
unpack the aab (its just a zip file)
decode the AndroidManifest which is a binary proto message with protoc
to decode you will need the .proto file found in the aapt2 tool
alter the version code/version name of the decoded android manifest
encode it again with protoc using the .proto files used in step 2
pack the aab with zip, but be careful not to zip directories and to remove the path prefix that you might add unwillingly
sign the zipped file with your store credentials, using jarsigner
zipalign the signed zipped file
rename the zipped, aligned and signed to the final .aab file
You can find these same steps in the following gist, with some of the work prepared before hand.
https://gist.github.com/Farious/e841ef85a8f4280e4f248ba8037ea2c0
I tried to avoid hardcoding anything and to bulletproof it, but it might not be yet.
in play store classic version , developer console gives an option for Halt rollout . if you will Halt rollout than current version of your app , will be unpublished from play store. Now we can published new version of app.
I want to push android apk to google play using google play service in automated way.
As of now I am building my android app using Ant and windows batch scripts and able to get the .apk file without any manual intervention.
Now I want to upload the generated .apk file to google play using google play services with help of ant and windows batch scripts in automated way.
When I google i come to know that by using gradle I can do it, but I am unable to build my project using gradle. So, I don't want to go this way.
I am able to push .apk to google play manually using my google play developer console.
Now I what to automate this process, How can i achieve this.
There's quite a bit of handling required with the Google Play Services API, for which the Windows batch commands are likely insufficient.
Since you don't want to change your project to Gradle, have you given a bit of thought to using Jenkins? It can be a light weight "provisioning" server on your system, that achieves what you want by using the Jenkins Google Play Android Publisher Plugin (see the complete step by step instructions). The good part is you don't have to change your Ant project. You can in future even automate more of your dev-test-deploy cycle by leveraging more of Jenkins capabilities.
You might want to look into Fastlane (and Supply in particular): https://github.com/fastlane/fastlane/tree/master/supply#readme
Basically, it's a command-line tool to upload binaries, screenshots and changelogs to Google Play.
I found this question for iOS and basically worry about the same thing for Android.
As part of the countinues integration process of my Android application, I want to create a process that will automatically upload the app (.apk) file to the Google PlayStore.
I found this website explaining how to create an .apk automated.
So I wonder if there is a way to upload the .apk file to the PlayStore via command line?
These days you can do this fairly easily with Gradle Play Publisher:
plugins {
id 'com.android.application'
id 'com.github.triplet.play' version 'x.x.x'
}
android {
...
}
play {
serviceAccountCredentials = file("your-credentials.json")
}
Then it's as simple as running ./gradlew publishApk.
This API should do it, as long as you are not publishing new app, but new version of an existing app. I've not used it yet though.
https://developers.google.com/android-publisher/
You could also use Jenkins, there is Jenkins plug-in for this purpose: https://wiki.jenkins-ci.org/display/JENKINS/Google+Play+Android+Publisher+Plugin