Getting Started by Creating Android App and Codesigning

Important

Visual Studio App Center is scheduled for retirement on March 31, 2025. While you can continue to use Visual Studio App Center until it is fully retired, there are several recommended alternatives that you may consider migrating to.

Learn more about support timelines and alternatives.

In this tutorial, you'll learn to set up a sample Android app with App Center.

Prerequisite Steps

Sign in to GitHub and fork the repository

  1. Sign in to your GitHub account.
  2. Access the sample app's GitHub repository.
  3. Click Fork at the top-right hand corner of the page.

Sign in to App Center

  1. Open the App Center portal.
  2. Click Connect with GitHub and sign in, or use another provider.

Create a new app in App Center

  1. Click Add new app.
  2. Name the app Sample Android App.
  3. Choose Android and Java respectively.
  4. Click Add new app.

Replace the App Secret

In order for the sample app to send information to App Center, the app secret must be changed to match the one provided for your specific App Center project.

  1. Navigate to your app page in App Center by clicking it in the Apps list.
  2. Go to the settings of your app by clicking Settings in the left sidebar.
  3. Click the three dots in the upper right corner to open the context menu and then within it, click Copy app secret.
  4. Go into the sampleapp_android repository and navigate into MainActivity.java
  5. In the project's MainActivity.java, locate the following. Note: You can also find the code snippet with your specific app secret on the Getting Started page in the App Center portal.
@Override
protected void onCreate(Bundle savedInstanceState) {
        AppCenter.start(getApplication(), "<APP SECRET HERE>",
                Analytics.class, Crashes.class);
  1. Replace <APP SECRET HERE> with your unique app secret.
  2. Add, commit, and push changes to your forked repository. This action can be done from the terminal, or a tool of your choice.

Sign the Android Package Kit (APK)

Code signing is optional, but recommended. To run tests and distribute the app to users, the APK must be digitally signed with a certificate. After creating an App ID for the sample app, follow the steps below to manually sign the APK. To learn what a digital certificate is, or for signing options other than the one outlined below, refer to the Android Developer Documentation.

  1. Open Android Studio and click Open an existing Android Studio project.

  2. Navigate to the forked sample app repository location on your machine and upload it to Android Studio.

  3. Go to Build Variants in the leftmost panel and click it.

  4. Make sure that the build variant is set to release.

  5. Go to Build > Generate Signed APK from the menu bar.

  6. Leave Module: app and click Next.

  7. In Key store path, click Create new... and create the keystore as per the following image from the Android Developer Documentation: Make a new app

  8. Click OK. The Key store password, Key alias and Key password should automatically fill in with the information from your new keystore. Click Next.

  9. Select a destination for the signed APK, make sure Build Type is set to release, and select both signature versions V1 and V2. Click Finish.

  10. Gradle should automatically begin to build. After everything syncs up, you should find your signed APK in the specified destination folder.

  11. Add, commit, and push changes to your forked repository.

Optional: Run app in Android Studio and read descriptions

The crashes and analytics services must be linked to the app in order for the associated buttons to send trackable data to App Center. Go to the crash quickstart and analytics quickstart for further details.