With the release of Xamarin for Visual Studio 4.2 and this week’s Service Release 0, archiving and publishing your Android applications directly from Visual Studio just got a whole lot easier and more streamlined. The new Archive Manager inside of Visual Studio enables you to easily package, sign, and directly ship your Android apps for Ad-Hoc and Google Play distribution.
Archiving and Packaging
Creating your first archive for distribution is as easy as right-clicking on your Android project and selecting Archive:
This will automatically build your Android application, create an APK using the version name and code from your Android Manifest, and create the first Archive. This Archive is in a pre-release state that allows you to write release notes, check app size, browse app icons, and distribute your application.
Distributing the App Ad-Hoc
Clicking on the Distribute… button will open the new Distribute workflow automatically in Ad-Hoc mode and will enable us to create, import, and store a keystore that will be used for signing the package.
Since this is our first project, we can create a new keystore and fill in the required fields. Once this is done, or if we are importing an existing keystore, it will be saved in secure storage so I can easily sign my applications in the future without having to search my machine for it.
Now, we can use the keystore by tapping on it and then clicking Save As, which will sign the app and allow us to save it to disk, which we can then send to a distribution service such as HockeyApp.
Distributing to Google Play
While we are often creating development and test builds, there are times we may want to publish directly to Google Play for production, which the Archive Manager also enables us to do during the distribution flow. Assuming that we have already created our app inside of the Google Play developer console and that we have turned on Alpha or Beta testing and published at minimum one release, back in the Archive Manager, select an archive to distribute and then click on the Distribute… button. This brings up an Ad-Hoc distribution flow, but we can click the back button and will then see an option for Google Play distribution:
Selecting Google Play will bring us back to our keystore selection to sign the app, but this time we’ll see that there is a new Continue button that will allow us to add our Google Play account when clicked.
To set up a Google Play API, it’s as easy as signing into our Google Play developer account, going to API Access in settings, and creating a new OAuth Client. This will give us our Client Id and Client Secret to enter into the dialog.
Click Register to finish registration, which will launch a web browser to finalize the oAuth flow to add your account.
Once the account is registered we can select it and continue to selecting a distribution channel to publish our application in:
There you have it: now you can create a keystore, package an Android app for Ad-Hoc distribution, and take it all the way to production on Google Play without ever leaving Visual Studio!
To learn more about preparing an Android application for release, be sure to read through our full documentation. You can find an in-depth overview of each step of the archiving and publishing process for both Visual Studio and Xamarin Studio in our documentation for Ad-Hoc and Google Play distribution.