Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 2.12 KB

README.md

File metadata and controls

67 lines (48 loc) · 2.12 KB

xamarin-android

Build Xamarin.Forms and Xamarin.Android projects in a docker container

For this docker image i used the following pages as references:

Included packages

Android SDK

Before using this container, you should agree with Android SDK License Agreement

Installed Android SDK Platform Tools (selected by tag):

  • API Level 26
  • API Level 27
  • API Level 28
  • API Level 29
  • API Level 30
  • API Level 31
  • API Level 32
  • API Level 33
  • Select tag <level>-ndkto include the ndk-bundle

.NET Core

Using dotnet-sdk-6.0 from https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb

Mono

Using preview-focal repo from mono-project.com

Xamarin Android OSS Linux

Using the latest artifact from here.

Paths

  • Xamarin: /xamarin/bin/Release/bin
  • Android SDK: /usr/lib/android-sdk
  • Android NDK: /usr/lib/android-sdk/ndk-bundle
  • Android CMD Tools: usr/lib/android-sdk/cmdline-tools/tools/bin

Example .gitlab.ci

stages:
  - build

build-android:
  image: tafilz/xamarin-android:29
  stage: build
  only:
    - master
  artifacts:
    paths:
      - publish_android/*.apk
    script:
      - export BUILD_DATE=$(date +%Y%m%d%H%M%S)
      - msbuild src/<solution_file_name>.sln /p:AndroidSdkDirectory=/usr/lib/android-sdk /p:Configuration="Release" /p:Platform="Any CPU" /restore
      - msbuild src/<android_project_directory>/<android_project_file_name>.csproj /p:AndroidSdkDirectory=/usr/lib/android-sdk /p:Configuration="Release" /p:Platform="Any CPU" /t:PackageForAndroid /p:OutputPath="../../publish_android/"
      - msbuild src/<android_project_directory>/<android_project_file_name>.csproj /p:AndroidSdkDirectory=/usr/lib/android-sdk /p:Configuration="Release" /p:Platform="Any CPU" /t:SignAndroidPackage /p:OutputPath="../../publish_android/"