Install xamarin on linux

0xfireball / xamarin-android-linux Goto Github PK

Detailed instructions on setting up Xamarin.Android on Linux!

xamarin-android-linux’s Introduction

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:

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!

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)

export ANDROID_SDK_PATH=$HOME/Android/Sdk export ANDROID_NDK_PATH=$HOME/Android/Sdk/ndk-bundle

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

/path/to/xamarin.android-oss*/bin/Debug/bin/xabuild /path/to/samples/HelloWorld/HelloWorld.csproj

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:

sudo ln -s /usr/lib/libzip.so /usr/lib/libzip.so.4

Next, try building a signed package:

/path/to/xamarin.android-oss*/bin/Debug/bin/xabuild /path/to/samples/HelloWorld/HelloWorld.csproj /t:SignAndroidPackage

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

This will enable building Xamarin.Android projects directly from msbuild .

xamarin-android-linux’s People

Contributors

Stargazers

Watchers

Forkers

xamarin-android-linux’s Issues

libzip.so.4

I’ve got an issue with libzip.so.4, I can’t install it via apt-get as I’m running Antergos (Arch Linux Derivative).

Your suggestion of sudo ln -s /usr/lib/libzip.so /usr/lib/libzip.so.4

So I suppose first off I need to figure out how to install libzip.so.4 , but after that I don’t really want to change the existing symbolic link that the system has, because that points to libzip.so.5, that could break other stuff I’m using.

Even if I manage to install libzip.so.4 somehow (not found it yet, no simple libzip4 package on Antergos), is there a way to have Rider use that without overwriting the system’s libzip.so pointing at libzip.so.5 ?

Читайте также:  Управление вентиляторами компьютера linux

Rider cannot build Xamarin Android

 CSC : error CS0006: Metadata file '/Reference Assemblies/Microsoft/Framework/MonoAndroid/v1.0/mscorlib.dll' could not be found 

I followed the guide as you specify. Any ideas?

Successfully build with new deb package

The Xamarin.Android Linux build job was moved to Azure pipelines and now I can successfully build a Xamarin project with Rider without needing to manually modify my Mono installation.

I used the package produced by this job.

Could not determine Android SDK location. Please provide `androidSdkPath`.

Hello,
I followed the steps for Rider on my Linux Mint(18.2) machine but with no luck. I am able to compile from the console even with the xbuild command but not inside rider where I get this error:
Xamarin.Android.Common.targets: [null] /usr/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task ResolveSdks: Could not determine Android SDK location. Please provide androidSdkPath .

Thanks for the guides you provided, using Xamarin in Linux is something I wanted to do for a long time.

Getting error when trying to build xamarin project

I’m trying to build solution with this artifacts and getting this error:

`xamarin.android-oss/bin/Release/bin/xabuild TestProject.sln /verbosity:d

Unhandled Exception:
System.IO.DirectoryNotFoundException: Could not find a part of the path ‘/tmp/pfchhxca.hoe’.
at System.IO.FileSystem.RemoveDirectory (System.String fullPath, System.Boolean recursive) [0x0001f] in :0
at System.IO.Directory.Delete (System.String path, System.Boolean recursive) [0x00006] in :0
at Xamarin.Android.Build.XABuild.Main () [0x00351] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.DirectoryNotFoundException: Could not find a part of the path ‘/tmp/pfchhxca.hoe’.
at System.IO.FileSystem.RemoveDirectory (System.String fullPath, System.Boolean recursive) [0x0001f] in :0
at System.IO.Directory.Delete (System.String path, System.Boolean recursive) [0x00006] in :0
at Xamarin.Android.Build.XABuild.Main () [0x00351] in :0 `

Can you help me to figure out with this issue?

No download titled xamarin.android-oss_.orig.tar.bz2 on the download link

So i am trying to install everything, just like shown in the tutorial, but i can’t download the release, because their is none, that fits the need. Probably i am just blind, but i downloaded two of the 9 releases, and both of them were wrong.
here is the link to check:
https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-linux/lastSuccessfulBuild/Azure/

Both archives have the following tree:
bin
-> Release
-> some more dirs
-> bin
-> even more dirs
-> Debug
-> some more dirs
-> bin
-> even more dirs

And there are many exe’s in there and dll
Thanks for any help!

The url above redirected me to a 404 page as of 02/24/2019.

How to launch HelloWorld in emulator

Not using Rider. By following the guide, I was able to build HelloWorld from xabuild command-line. In the output folder I get HelloWorld.dll. How do I launch this in an android emulator?

Cannot find the bin/Debug/bin folder

I cannot complete this step of your guide:

Let’s also copy the Xamarin.Android tools in bin:

sudo mkdir -p /usr/lib/mono/xamarin-android/bin/
sudo cp -r bin/Debug/bin/* /usr/lib/mono/xamarin-android/bin/

I do not find such a folder as bin/Debug/bin. Where should it be located? I cannot find such a folder in any of the Xamarin build artifacts, in particular not in the one you point out in your guide.

Читайте также:  Репозиторий в linux это

Building with msbuild from command line

first of all, thanks for writing this excellent guide.
I managed to build my app with xabuild and also with msbuild through Rider. I am wondering how to use msbuild from the command line with app signing. Also I saw you were able to use the debugger. I am unable to run the application on my phone via Rider. Can you shed light on how to do this? In rider it says that my program doesn’t have an entry point, which makes sense I guess. Also with Advanced Build Actions -> Package Selected Projects I get this error: /usr/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(631,2): error MSB4018: The «ResolveSdks» task failed unexpectedly. [/home/omar/Trash/working with maps/Android/WorkingWithMaps.Android.csproj] /usr/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(631,2): error MSB4018: System.InvalidOperationException: Could not determine Android SDK location. Please provide androidSdkPath . [/home/omar/Trash/working with maps/Android/WorkingWithMaps.Android.csproj]

Any hints would be much appreciated.

Источник

Beyond Velocity

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

Xamarin.Android on Ubuntu 19.04

xamubu19

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:

MISSING LIBZIP.SO.4

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

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.

Читайте также:  Pdf принтеры для linux

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

xambetter

Share this:

Like this:

11 thoughts on “ Xamarin.Android on Ubuntu 19.04 ”

ParadigmShift3d (@paradigmshift3d) says:

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 Like

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 Like

ParadigmShift3d (@paradigmshift3d) says:

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. Like Liked by 1 person

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 Like Liked by 1 person

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 Like

Источник

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