Xamarin.Android on Ubuntu 19.04

xamubu19
My App up and running in Ubuntu 19.04

Update: Xamarin on Linux was too much of a moving target. These instructions are obsolete.

INTRODUCTION

Some time ago I wrote a post on how to install Xamarin.Android in Linux. At the time I was using Kde Neon which was based upon Ubuntu 18.04. Recently I tried to follow the same instructions to set up Project Rider for Android development on Ubuntu 19.04. Pretty much everything went smoothly, except for a couple of issues. For anyone interested, follow the previous instructions and apply the differences listed below.

INSTALL ORACLE JDK

You currently need to use Oracle Java 8 to build Xamarin Android projects in Project Rider. This isn’t available in any repositories that I know of, so I downloaded and unzipped this project from github, then I downloaded the Oracle Java 8u212 SDK from here into the same unzipped folder I had just created. I then executed the following command to install it:

yes | sudo ./install-java.sh -f jdk-8u212-linux-x64.tar.gz

INSTALL XAMARIN.ANDROID

The official Xamarin for Linux builds have been failing for over a month. For this install I used build 2194, which was the last successful build, you can find artifacts for the last successful build here. The file I downloaded was:

xamarin.android-oss_v9.2.99.172_Linux-x86_64_master_d33bbd8e-Debug.tar.bz2

MISSING LIBZIP.SO.4

Project Rider could not find libzip.so.4 The solution was:

cd /usr/lib/x86_64-linux-gnu/

sudo apt-get install libzip-dev

sudo ln -s libzip.so.5.0 libzip.so.4

REPLACE SYSTEM.REFLECTION.METADATA

As per the previous instructions, download the nuget package, unzip it, and then copy the file System.Reflection.Metadata.dll from the lib/netstandard2.0 folder over the file found in /usr/lib/mono/msbuild/15.0/bin/

RENAME Strings.xml

If you create a new project, and get an error that a string resource can’t be found, rename the file Strings.xml in the file system to strings.xml.

CONCLUSION

Overall the installation went well.

I must say Project Rider is coming on in leaps and bounds, many of the features of Android Studio are starting to find their way into the IDE such as tools:

tools

And a working designer!

xambetter

Advertisement

11 thoughts on “Xamarin.Android on Ubuntu 19.04

  1. I’ve been working to get Rider working for the past two days now and I can create Xamarin projects just fine, and have Android Emulator/SDK/NDK all set up. However, when my project loads in Rider, I get the following error:

    “Xamarin SDK was not found: Rider was unable to find Xamarin SDK on this machine. Xamarin-based projects will not be loaded. Please install Xamarin SDK or change toolset.”

    I’ve followed both this guide and this one (https://github.com/0xFireball/xamarin-android-linux/blob/master/rider-setup.md) including multiple purge/reinstalls of mono and dotnet.

    I have read over this Stack Overflow post (https://stackoverflow.com/questions/48628318/failed-to-load-xamarin-forms-project-with-net-standard-2-0-lib-in-rider) and I believe my settings are in line with what they suggest there, but it’s not changing anything.

    Do you have any suggestions as to where I can begin looking/experimenting to sort this out?

    Like

    1. Hi ParadigmShift3d, sorry to hear about your troubles.

      I’ve installed Xamarin on Linux 4 or 5 times by following only the steps listed in my posts (no other source, no StackOverflow etc). I’m not sure what might be wrong. Project Rider/Xamarin is constantly changing, so it’s hard to pin down a process to install it.

      It’s been about two months since I wrote this guide, and I’ve since switched to Flutter and Delphi for Mobile. I’m flat-out at the moment, but if I get a break I’ll run through the install again and make sure it still works.

      In the meantime, if you haven’t already, take a look at the JetBrains website on installing Xamarin in Linux – most likely the last pages of the comments will be more relevant:

      https://rider-support.jetbrains.com/hc/en-us/articles/360000557259?page=1

      Like

      1. Thanks for the quick reply! I’ve also read through that one as well, but thank you for the link. I’m on version 2019.1.3, so I wonder if they changed something, but I will give it another go. Flutter does look nice, but I haven’t had a chance to try it out.

        Liked by 1 person

  2. This is an absurdly bad idea:

    sudo ln -s libzip.so.5.0 libzip.so.4

    You are installing an incompatible library in the place of libzip.so.4

    Better to download the following:

    https://ubuntu.pkgs.org/18.04/ubuntu-universe-amd64/libzip4_1.1.2-1.1_amd64.deb.html

    curl -v -o libzip4_1.1.2-1.1_amd64.deb http://archive.ubuntu.com/ubuntu/pool/universe/libz/libzip/libzip4_1.1.2-1.1_amd64.deb

    sudo dpkg -i libzip4_1.1.2-1.1_amd64.deb

    Liked by 1 person

    1. Hi Sebastian,

      I wasn’t too comfortable doing that as libzip4 is available in Ubuntu 18.04 not 19.04.

      Given libzip has a pretty good record for backwards compatibility, I chose to link to libzip5 which comes with Ubuntu 19.04.

      But if there are no dependency issues with your method, I agree it is a better solution.

      Thanks for the recommendation, appreciated.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s