Return to site

Build Android Apps On A Mac

broken image


Oct 09, 2017  MacHow2. Last Updated: November 15, 2016. It's now extremely easy to run Android Apps on Mac thanks to Google's ARC Welder extension for Google Chrome. ARC Welder is a simple extension which allows you to easily run an Android app on your Mac or PC with no need for any other software. All you need is the Google Chrome browser. Open the Settings or Preferences dialog: On Windows or Linux, select File Settings from the menu bar. On Mac OSX, select Android Studio Preferences from the menu bar. Navigate to Build, Execution, Deployment Compiler.

-->

Azure Pipelines

This guidance explains how to automatically build Xamarin apps for Android and iOS.

Build

Example

For a working example of how to build a Xamarin app, import (into Azure Repos or TFS) or fork (into GitHub) this repo:

The sample code includes an azure-pipelines.yml file at the root of the repository. You can use this file to build the app.

Follow all the instructions in Create your first pipeline to create a build pipeline for the sample app.

Build environment

You can use Azure Pipelines to build your Xamarin apps without needing to set up any infrastructure of your own. Xamarin tools are preinstalled on Microsoft-hosted agents in Azure Pipelines. You can use macOS or Windows agents to run Xamarin.Android builds, and macOS agents to run Xamarin.iOS builds. If you are using a self-hosted agent, you must install Visual Studio Tools for Xamarin for Windows agents or Visual Studio for Mac for macOS agents.

For the exact versions of Xamarin that are preinstalled, refer to Microsoft-hosted agents.

Create a file named azure-pipelines.yml in the root of your repository. Then, add the following snippet to your azure-pipelines.yml file to select the appropriate agent pool:

Build a Xamarin.Android app

Build Android Apps On A Mac

Example

For a working example of how to build a Xamarin app, import (into Azure Repos or TFS) or fork (into GitHub) this repo:

The sample code includes an azure-pipelines.yml file at the root of the repository. You can use this file to build the app.

Follow all the instructions in Create your first pipeline to create a build pipeline for the sample app.

Build environment

You can use Azure Pipelines to build your Xamarin apps without needing to set up any infrastructure of your own. Xamarin tools are preinstalled on Microsoft-hosted agents in Azure Pipelines. You can use macOS or Windows agents to run Xamarin.Android builds, and macOS agents to run Xamarin.iOS builds. If you are using a self-hosted agent, you must install Visual Studio Tools for Xamarin for Windows agents or Visual Studio for Mac for macOS agents.

For the exact versions of Xamarin that are preinstalled, refer to Microsoft-hosted agents.

Create a file named azure-pipelines.yml in the root of your repository. Then, add the following snippet to your azure-pipelines.yml file to select the appropriate agent pool:

Build a Xamarin.Android app

To build a Xamarin.Android app, add the following snippet to your azure-pipelines.yml file. Change values to match your project configuration. See the Xamarin.Android task for more about these options.

Sign a Xamarin.Android app

See Sign your mobile Android app during CI for information about signing your app.

Next steps

See Android guidance for information about:

  • Signing and aligning an Android APK
  • Testing on the Android Emulator
  • Testing on Azure-hosted devices
  • Retaining build artifacts with the build record
  • Distributing through App Center
  • Distributing through Google Play

Android App For Mac

Build a Xamarin.iOS app

To build a Xamarin.iOS app, add the following snippet to your azure-pipelines.yml file. Change values to match your project configuration. See the Xamarin.iOS task for more about these options.

Sign and provision a Xamarin.iOS app - The PackageApp option

To generate a signed and provisioned Xamarin.iOS app .ipa package, set packageApp to true and make sure prior to this task you installed the right Apple Provisioning Profile and Apple Certificates that match your App Bundle ID into the agent running the job.

To fulfill these mandatory requisites use the Microsoft Provided tasks for installing an Apple Provisioning Profile and installing Apple Certificates.

Tip

The Xamarin.iOS build task will only generate an .ipa package if the agent running the job has the appropriate provisioning profile and Apple certificate installed. If you enable the packageApp option and the agent does not have the appropriate apple provisioning profile(.mobileprovision) and apple certificate(.p12) the build may report succeeded but there will be no .ipa generated.

For Microsoft Hosted agents the .ipa package is by default located under path:
{iOS.csproj root}/bin/{Configuration}/{iPhone/iPhoneSimulator}/

You can configure the output path by adding an argument to the Xamarin.iOS task as following:

This example locates the .ipa in the Build Artifact Staging Directory ready to be pushed into Azure DevOps as an artifact to each build run.To push it into Azure DevOps simply add a Publish Artifact task to the end of your pipeline.

See Sign your mobile iOS app during CI for more information about signing and provisioning your iOS app.

Use Android Apps On Mac

Expand menu Advanced for the Xamarin.iOS build task and add /p:IpaPackageDir='/Users/vsts/agent/2.153.2/work/1/a' in the input field Arguments to place the generated .ipa package in the Build Artifact Staging Directory. To push it into Azure DevOps simply add a Publish Artifact task to the end of your pipeline.

Set the Xamarin SDK version on macOS

To set a specific Xamarin SDK version to use on the Microsoft-hosted macOS agent pool, add the following snippet before the XamariniOS task in your azure-pipelines.yml file. For details on properly formatting the version number (shown as 5_4_1 below), see How can I manually select versions of tools on the Hosted macOS agent?.

Build Xamarin.Android and Xamarin.iOS apps with one pipeline

You can build and test your Xamarin.Android app, Xamarin.iOS app, and related apps in the same pipeline by defining multiple jobs in azure-pipelines.yml. These jobs can run in parallel to save time. The following complete example builds a Xamarin.Android app on Windows, and a Xamarin.iOS app on macOS, using two jobs.

Next steps

See Xcode guidance for information about:

  • Testing on Azure-hosted devices
  • Retaining build artifacts with the build record
  • Distributing through App Center
  • Distributing through the Apple App Store




broken image