Xamarin android download linux

Xamarin android download linux

Setting up Xamarin.Android on Linux

A guide to getting Xamarin.Android ready to use on your distro of choice!

This guide has been tested successfully:

  • Arch Linux as of Feb 3, 2018
  • Ubuntu 16.04 ( mono-5.8 ) as of Feb 23, 2018

Note that this is officially unsupported, but it can be used as a loose guide to help in setting this up on your system.

Xamarin has stated that there are no plans to officially support Linux. However, since Xamarin was open sourced, the developers have made it possible to manually install Xamarin.Android, and with some tweaking we can get full debugging support in Rider!

  • Latest mono packages for your platform

Obtain Xamarin.Android binaries

Prebuilt Releases (Recommended)

Download the xamarin.android-oss_*.orig.tar.bz2 package to your system and extract it.

See their instructions on building from source.

Install the Android SDK and NDK, then set environment variables:

(You may have to adjust the paths; these are the default for Android Studio)

Build a test project (there’s one in the source repository) for Xamarin.Android.

The build should complete successfully. If you have problems, try adding /verbosity:d to get detailed output from the build process. You may have a minor error about libzip.so.4 not being found, just create a symlink to your libzip:

Next, try building a signed package:

This will invoke keytool and generate a keystore and use it to sign an .apk file, which will go to your output directory with a name like YourTestProject-Signed.apk .

Bonus: IDE (especially JetBrains Rider) support

Источник

Beyond Velocity

Coding this side of eternity – simple, direct, efficient.

Xamarin.Android on Ubuntu 18.04

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

Thanks to the awesome guys at JetBrains and their Project Rider IDE, it’s now possible (unofficially) to develop Xamarin.Android apps on Linux.

This is a basic project created with Project Rider and running on the emulator:

Once I had a basic application up and running, I tried an application I’ve had in the store for a while (Temperament). It worked perfectly:

I’m running KDE NEON based upon Ubuntu 18.04, which you can download from here. For help on setting up KDE NEON, see here.

Note: Project Rider and Xamarin.Android is still a work in progress, so things change from time to time. I’ve updated this document as per my last successful install on Kde Neon and Ubuntu 19.04. There’s an Updates section at the end as a kind of history of the changes. If you get stuck, take a look at that section and some of the comments. These instructions are for Ubuntu 18.04 based distributions, for Ubuntu 19.04 there’s a few changes, please see here.

Install Essential Libraries

sudo apt-get install curl lzip lunzip plzip build-essential cmake automake autoconf libc6-i386 libncurses5:i386 libstdc++6:i386 lib32z1 libc6:i386 libbz2-1.0:i386 uudeview apt-transport-https

Setup Android Studio

Before installing Android Studio, starting with Ubuntu 18.04 you need to install qemu-kvm. Enter these commands:

sudo apt install qemu-kvm

Читайте также:  Ubuntu шрифты как mac os

sudo adduser $USER kvm

Next install Android Studio by downloading from here, extracting the archive, then running bin/studio.sh from the newly created android-studio folder.

Once Android Studio is up and running, test you can create a simple Android project and deploy to a virtual device (I created a Nexus 5×28 x86_64 device).

Now install SDK 28 and the NDK bundle via Android Studio.

Install Mono and .Net Core

Next install Mono as per the instructions here, and .NET Core as per here.

Update your .bashrc (found in your home folder), it should look something like this:

Note: I had installed Android SDK to the default folder: $HOME/Android/Sdk

Update: Creating a symlink (see the following commands) was not required on my latest install, I advise you skip it. You can always do it later if you have a problem starting an emulator.

The next thing we need to do is create a symlink to the Android Emulator:

ln -s ../emulator/emulator emulator-x86

Install Oracle JDK

sudo add — apt — repository ppa : webupd8team / java

sudo apt — get update

sudo apt — get install oracle — java8 — installer

Install Xamarin.Android

Download a stable build from here.

I used: xamarin.android-oss_v9.1.199.8_Linux-x86_64_master_878ba261-Debug.tar.bz2

Update: The official Xamarin for Linux builds have been failing for over a month. Use the last successful build, you can find artifacts for the last successful build here.

Go to the unpacked dir:

Copy dir from extracted files:

Delete dirs for next step:

Replace System.Reflection.Metadata

As mentioned in the updates section below, you need to replace an assembly. Download this 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/

Configure SDK and NDK paths in Rider settings

Update: In the latest version I just created a new Xamarin.Android project and the template prompted me to click a button to set up these paths.

Go to “File | Settings | Build, Execution, Deployment | Android” and set “Android SDK Location”, “Android NDK Location”, and “Java Development Kit Location” . For me, the locations are:

Update your Project File

You can now create a new Xamarin.Android project.

Whether you are creating a new project, or using an existing one, you need to update your project file. Open the .csproj file in your favourite editor, find this section:

And add this setting:

If you are using an existing project and you have the following import directive at the end of the project file:

Change it to this:

You should now be able to build and deploy your project to a virtual device on Linux.

Note: if you copy and paste, ensure the quotes are correct or you’ll get an error.

Strings.xml should be 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

I’d like to say a big thank you to the JetBrains team for this blog, and to Andreas Go for his help with getting the project file right. Project Rider is shaping up to be an awesome IDE.

Update:

Recently people have been reporting build issues, thanks to Abdelrahman here is a fix:

I was having the same issue as @JENS ECKERVOGT, after some researching about the subject i found out they changed from the msbuild built-in System.Reflection.Metadata to the one that comes with corefx project because it’s much faster.

so i searched nuget for System.Reflection.Metadata (https://www.nuget.org/packages/System.Reflection.Metadata/) downloaded the package and opened it in archive manager copying the dll that’s in netstandard 2.0 to msbuild directory and also did the same with (https://www.nuget.org/packages/System.Collections.Immutable/) and every thing works fine now

Читайте также:  Mac os проверить порты открыты или нет

Update 2:

I’ve just been through a complete re-install, all of the above instructions worked fine (I needed to use Abdelrahman’s fix mentioned above but only for System.Reflection.Metadata). The location of the msbuild folder is:

For this install, I used this Xamarin build:

I had two minor issues:

Firstly, the settings (see Configure SDK and NDK paths in Rider settings section) has changed from:

File | Settings | Build, Execution, Deployment | Xamarin

File | Settings | Build, Execution, Deployment | Android

And you will need to enter the jdk location too, I specified:

The article has been updated accordingly.

Secondly, if you copy and paste the project file changes mentioned above (see the Update your Project File section) to an existing .csproj file, make sure the double quotes are correct after you paste the specified text, or your project won’t load.

This is a second application I just managed to run in Xamarin.Android on Linux following my latest install. I wrote this a few years ago and it is using a background service for playing an audio playlist. Everything is working as expected:

Share this:

Like this:

19 thoughts on “ Xamarin.Android on Ubuntu 18.04 ”

Nice article. But JetBrains is not the only one that deserves credit. There is also the Mono-project.

I Can’t get it to work.
I followed all your Steps however I can’t build a new Project.

AndroidManifest.xml(6): [APT0000] resource string/app_name (aka Template.Template:string/app_name) not found.
AndroidManifest.xml(7): [APT0000] resource string/app_name (aka Template.Template:string/app_name) not found.
Xamarin.Android.Common.targets(2434, 3): [APT0000] failed processing manifest.

Hi Simon, I’m too busy at the moment to investigate your issues, but in the meantime, can you check the entry in the manifest matches your resource name, i.e. string/app_name should probably be strings/app_name?

Hi Velocity 🙂
I can’t really explain it but it suddenly started working for me…

I first thought there was a problem with the xamarin build.
As Consequence I did download the build again, reinstalled libzip4.
While it still didn’t work I tried to build a HelloWorld sample without rider, just using the xabuild…

After that rider suddenly recognizes everything to be fine and I can now Build and Run perfectly fine..

Maybe I should add something..
From the template rider creates a strings.xml in the ResourcesFolder, however it References a “missing” Strings.xml (CaseSensitivity!!), so you either have to check the Dependencies or simply rename this file.

Hey @Simon and @CSVelocity,
Yeah you are right,

I have tried to fix but I have sometimes error why does Xabuild won’t build cause it has sometimes assemblies not found like this

How do you have not problem but for me not fixed. How do you have success? PLEASE TELL ME! I am very disappointed. Because I really miss to develop with Xamarin.Android on Linux and Rider. – Because I don’t like Windows 10 because Windows 10 failed major update into default desktop ( it seems after installation of Windows 10 ) since September/October 2018. I stopped work with Windows 10. I am working on Ubuntu. Why do idiots not support for MonoDevelop. That is why I am very disappointed and I don’t understand how does MonoGame Team work Android project for MonoDevelop. I feel like they lie me. Since 2 or 3 weeks later I found Rider and I have big problem with Xamarin.Android and Rider because it seems like string.xml and sometimes assemblies not found. I have already compiled Xamarin.Android from Github and compiled on Ubuntu 18.04 and It works fine ok. But Rider and xabuild won’t compile because I have problem with not found assemblies. How do I find?
in /usr/lib/mono/4.5 or /usr/lib/mono/xbuild.frameworks or I want find for current assemblies.

Читайте также:  Чем планшеты с windows лучше планшетов с android

well I can only take a guess but it looks like you’re missing some mono packages.

Have you tried reinstalling mono ??
sudo apt-get install –reinstall mono-complete

I am very disappointed – Because it looks shit because Rider shows only latest Android version I want use old version of Android 8.1 ( Oreo )

Why does Rider not compile successful ? =(

Because I have already tried downloading Xamarin Android from github and I compiled successful. copy to /usr/lib/mono than i open Rider and create Xamarin Android App and it seems like shit always error error error error error….

I have tried 5 or 6 times = NO SUCCESS.

How did you get success? PLEASE SHOW ME VIDEO WITH SUBTITLE I want understand.

Hi Jens, sorry to hear it is not working for you. I documented the steps I took to do two successful installs. I’ve been super busy lately, but will do another install soon and if necessary I’ll update the blog accordingly. Regarding versions, I just use what Microsoft makes available via their Jenkins builds.

Just install the 27API from within the Android SDK manager.
I am using 8.1 too and have no Problems so far.

Thanks for your feedback Simon, glad you got it working. Hopefully Rider will evolve to be something like Android Studio for Xamarin, it’s awesome coding C# in Linux 🙂

Hi Jens, sorry to hear of your troubles again, must be very frustrating.

Are you able to create an Android Studio project and run it in an emulator? Can you create a mono project in Project Rider and run it successfully? If not, perhaps you’ll need to try a fresh install of Ubuntu 18.04 and follow the steps in the post exactly? For example, I don’t compile Xamarin.Android from Github.

If you do try a fresh install, you’ll need to install packages like buildessential, and any libraries Android Studio needs to work correctly on Ubuntu. Make sure Android Studio and Project Rider is working BEFORE proceeding with the Xamarin.Android installation (Create a simple Android project, then create a Mono console project and run them).

I’m really busy at the moment, but when I get a chance I’ll do another post soon specifically for Ubuntu 18.04 – from initial install up to and including Xamarin.Android for project Rider. In the meantime, I hope this helps.

I was having the same issue as @JENS ECKERVOGT, after some researching about the subject i found out they changed from the msbuild built-in System.Reflection.Metadata to the one that comes with corefx project because it’s much faster.

so i searched nuget for System.Reflection.Metadata (https://www.nuget.org/packages/System.Reflection.Metadata/) downloaded the package and opened it in archive manager copying the dll that’s in netstandard 2.0 to msbuild directory and also did the same with (https://www.nuget.org/packages/System.Collections.Immutable/) and every thing works fine now 🙂

Thanks Abdelrahman, appreciate your feedback. I’m afraid I’ve been too busy to follow up on this. I’ve updated the article with your fix at the end. Thanks again!

Thanks for resolving my problem i will try out.

Источник

Оцените статью