Xamarin Android code signing

Configuring code signing in Visual Studio

You can specify the code signing configuration for your Xamarin Android project by creating a signed APK in Visual Studio.

  1. Open Visual Studio.
  2. Select APK or AAB as package format in your Android project config in Visual Studio. For more information, check out Microsoft’s blog post.
  3. Double click on your Xamarin Android project to open Project Options.
  4. Select the Android Package Signing in Build group.
  5. Select your configuration and platform in Configuration - Platform.
  6. Check the Sign .APK file using the following keystore details.
  7. Fill out the signing information.

Using the same keystore path locally and on for Xamarin Android

You can not use Environment Variables in your keystore path in your Xamarin project! The keystore path has to be relative to the folder of your Xamarin Android project. You can also use an absolute path.

You can use the same path on your local machine and on by putting your keystore into your repository.

Gitignore your keystore

Don’t forget to gitignore your keystore in your repository!

Since your keystore is gitignored, you have to upload your keystore to the GENERIC FILE STORAGE of Bitrise and download it to the same location in the build.

  1. On the Dashboard select your app.
  2. Click the Workflow tab to open the Workflow Editor.
  3. Click Code signing.
  4. Scroll down to the GENERIC FILE STORAGE field.
  5. Type your Environment Variable name here in the first field. In our example, we use XAMARIN_KEYSTORE.

    Xamarin Android code signing

  6. Upload your keystore file in the Upload file field.

    Your Environment Variable (for example, $BITRISEIO_XAMARIN_KEYSTORE_URL) will be automatically available with the download URL of your keystore file.

    Xamarin Android code signing

  7. Navigate back to your workflow.
  8. Insert the File Downloader Step before the Xamarin Archive Step. The File Downloader Step will get a Download source url input.
  9. Type your Environment Variable, for example, $BITRISEIO_XAMARIN_KEYSTORE_URL in the Download source url field.
  10. Set your keystore path in the Download destination path.

Xamarin Android code signing

Bitrise keystore path

Ensure that your Bitrise keystore path is the same as your local path relative to your project root. For example, if keystore.jks is in your project’s root, then your Bitrise keystore path has to be $BITRISE_SOURCE_DIR/keystore.jks.