(Obsolete) How to develop Xamarin.Android applications on Linux with Rider
Unfortunately, we don’t have resources to investigate what has been changed in the last Xamarin.Android Versions for Linux. Therefore, we have no plans to update this article in the nearest future.
Thank you for your understanding.
Please keep in mind, that the steps below are obsolete for the last Xamarin.Android Versions for Linux!
This article was tested on versions of Xamarin.Android released in 2018.
Please note that Xamarin.Android on Linux is officially unsupported. However, it is possible to manually install Xamarin.Android and configure Rider so that it can build and run Xamarin.Android apps on Linux. This guide has been tested on Ubuntu 16.04.
Install the latest stable Mono
See http://www.mono-project.com/download/
sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/mono-official.list
sudo apt-get update
sudo apt-get install mono-devel
Install JDK
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer (or sudo apt-get install oracle-java9-installer)
sudo apt-get install default-jdk
Install Android Studio
Download Android Studio https://developer.android.com/studio/index.html
Install Android Studio https://developer.android.com/studio/install.html
Download appropriate Android SDK and NDK
Install Xamarin.Android
Download any stable build:
Choose any oss-xamarin.android_vVERSION_Linux-x86_64_HEAD*.tar.bz2
artifact from https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-linux/
Extract it:
tar xjf ./oss-xamarin.android_v{VERSION}_Linux-x86_64_HEAD{*}.tar.bz2
Goto the unpacked dir:
cd ./oss-xamarin.android_v{VERSION}_Linux-x86_64_HEAD{*}
Make dirs:
sudo mkdir "/usr/lib/xamarin.android"
sudo mkdir "/usr/lib/mono/xbuild/Xamarin/"
Copy dir form extracted files:
sudo cp -a "bin/Debug/lib/xamarin.android/." "/usr/lib/xamarin.android/"
Delete dirs for next steps:
rm -rf "/usr/lib/mono/xbuild/Xamarin/Android"
rm -rf "/usr/lib/mono/xbuild-frameworks/MonoAndroid"
Make Symlinks:
sudo ln -s "/usr/lib/xamarin.android/xbuild/Xamarin/Android/" "/usr/lib/mono/xbuild/Xamarin/Android"
sudo ln -s "/usr/lib/xamarin.android/xbuild-frameworks/MonoAndroid/" "/usr/lib/mono/xbuild-frameworks/MonoAndroid"
Add the next lines to your csproj file:
<PropertyGroup Condition=" '$(OS)' == 'Unix' ">
<MonoAndroidToolsDirectory>/usr/lib/mono/mandroid</MonoAndroidToolsDirectory>
<MonoAndroidBinDirectory>/usr/lib/mono/xamarin-android/bin</MonoAndroidBinDirectory>
<AndroidSdkDirectory>$(ANDROID_SDK_PATH)</AndroidSdkDirectory>
<AndroidNdkDirectory>$(ANDROID_NDK_PATH)</AndroidNdkDirectory>
</PropertyGroup>
Make sure that ANDROID_SDK_PATH and ANDROID_NDK_PATH
environment variables are set.
Configure SDK and NDK paths in Rider settings
Go to "File | Settings | Build, Execution, Deployment | Xamarin" and set "Android SDK location" and "Android NDK location".
You should now be able to build and run Xamarin.Android applications on Linux with Rider.
Please sign in to leave a comment.
I followed this, created a new Xamarin.Android project but am getting this error at build time. I have the Android_SDK_Path set correctly. An y guidance?
Also the SDK is set here. I appreciate the help :)
Michael,
SDK and NDK location settings on Linux are not always saved correctly, which is a bug. Please try to save them again via Enter, restart Rider, and check the settings again to make sure they have been applied.
Just can't get this working in Ubuntu 18.04 - It builds fine, but deployment is problematic. I can't launch the x86_64 system image (api 28) with emulator64_x86 - it complains it can't find the kernel, the specific error is:
[Please ensure the file "kernel-qemu" is in the same location as your system image]
I can launch the x86_64 image with emulator, but then the adb deployment command fails saying:
['INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
I'm guessing that is because the Xamarin build files downloaded from Jenkins are x86_64 not x86?
If I'm not mistaken, the problem is the inability to launch the x86_64 system image using emulator64_x86?
@David
Add the following line in your *.csproj File for your Android Project inside the PropertyGroup
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
....
<AndroidSupportedAbis>arm64-v8a;armeabi-v7a;x86;x86_64</AndroidSupportedAbis>
....
</PropertyGroup>
It seems that the default "AndroidSupportedAbis" are different than under Visual Studio for MacOS. There I could change the supported ABIs and the new <AndroidSupportedAbis> was created.
I hope that fixes your problem.
I didn't needed the
<PropertyGroup Condition=" '$(OS)' == 'Unix' " /> Section.
It's broken anyway because the MonoAndroidToolsDirectory and
MonoAndroidBinDirectory directories don't exist.
I face the problem that I cannot launch the Android Project from the context Menu of the Project in the Solution View:
Cannot run project of type XamarinAndroid with a .NET Project run configuration. You can run this project using one of the following configuration types: Xamarin.Android.
Running it from the Toolbar with the correct Run/Debug configuration works though.
Thanks to the excellent support at JetBrains and Andreas Go's help, I'm now up and running.
For anyone interested, I've made a blog post based on the above instructions:
https://beyondvelocity.blog/2018/11/29/xamarin-android-on-linu/
Thanks JetBrains!
link to Jenkins mono do not work! What I must do? Is your rider usable or VS better
Thanks for the heads up Gvitaha, just checked it out it seems the CI service is temporarily down, should be up soon - see here (Monday they say):
https://jenkins.mono-project.com/
I followed all of the Instructions above, but I can't get it to work.
Okay I don't know why it works now...
I just tried to build a sample HelloWorld Project to find out if the culprit is Rider or xamarin-android for linux...
As I followed that guide here ( https://github.com/0xFireball/xamarin-android-linux ) I successfully built the HelloWorld app.
After that I started my Project again, and after a rebuild everything appeared to work as it should.... Strange thing...
Hello everyone I am very disappointed because Xamarin.Android fails for me. How do you get successful? I am very sad because I want build Android apps . :( Because I feel they lie me and don't care my solution. STOP PLEASE DO NOT LIE / SCAM US ! PLEASE MAKE SURE - I HAVE DOWNLOADED Xamarn-Android from Github and compiled successfully. But why Rider mess up if it said Android 9.0 That is WRONG I WANT USE ANDROID 8.1 Oreo
It said always failures. I am very disappointed I have 5 or 6 times = NOOOOOOOOOOOOOOOOOOOOOO SUCCCEESSS!!!
PLEASE SHOW ME VIDEO OF YOUTUBE WITH Xamarin Android from Github and compilation than copy to /usr/lib/mono than Open rider and create Xamarin Android. Please!!!
I have always unsuccessful / failure GRRRR I am very mad because I feel Rider makes shit PLEASE PROMISE US! I WANT BUY SOON IF YOUR RIDER MAKES SHIT THAN I DON'T BUY and I go back MonoDevelop. Please make sure!!!! Sorry I am not harassing just I am very sad and disappointed because I can't get successful compilation :( I really miss to develop with Xamarin Android =(
Thanks!
// EDIT Now I have big problem :(
How do I fix?
I am tried to fix.... I am very disappointed :(
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 folder to msbuild directory (Replace the existing file) and also did the same with (https://www.nuget.org/packages/System.Collections.Immutable/) and every thing works fine now :)
Hey there :)
Is anyone able to use a Smartphone for USB Debugging ??
I can't get it to work...
Followed this guide before but with the latest Rider release it says that it could not
find the Xamarin SDK and that no Xamarin based projects will be loaded.
Is there a workaround?
Hi Joelsc,
I have instructions for Ubuntu 19.04 here:
https://beyondvelocity.blog/2019/06/02/xamarin-android-on-ubuntu-19-04/
And Ubuntu 18.04 based distros here:
https://beyondvelocity.blog/2018/11/29/xamarin-android-on-linu/
Hope that helps.
It would be more helpful to know what is looking at what. This sort of "follow these steps to a tee" thing is terrible - it falls apart at the first sign of trouble. I don't know what this is supposed to look like, so if I don't want/can't have my setup *exactly* like yours for whatever reason then this is just as helpful as e.g. https://github.com/0xFireball/xamarin-android-linux/blob/master/rider-setup.md which is to say, not very.
:(
Why is it that you pay people and eventually they decide things are "not supported" whereas people who aren't paid tend to be like "well you know I don't know but here I'll try and help with that". Where's the service? WTH am I paying for?
Step 3: is wrong, it should read:
Or you know it should just read "Make sure these three directories exist". Don't *ever* recommend a command for a directory unless you're 100% sure it exists... unless it exists as a zipfile file with a known structure you *cannot* rely on "hey run this installer thing from this website" - that's just bad directions.
This guide is quite a mess...
I have spent 2 days (!!!) and finally I succeded in using xamarin in Rider on Ubuntu 16.04 doing following steps:
After you downloaded xamarin android archive and extracted it
Go in the extracted folder
cd /path/to/xamarin.android/
and then do
sudo cp -r bin/Debug/lib/xamarin.android/xbuild/Xamarin /usr/lib/mono/xbuild/
sudo cp -r bin/Debug/lib/xamarin.android/xbuild/Novell /usr/lib/mono/xbuild/
sudo cp -r bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid /usr/lib/mono/xbuild-frameworks/
sudo mkdir -p /usr/lib/mono/xamarin-android/bin/
sudo cp -r bin/Debug/bin/* /usr/lib/mono/xamarin-android/bin/
Please notice:
- as said here, if you use mono 5.*, you must use a compatible dotnet core version, 2.2.108, download it here and uninstall other versions of dotnet core!
- as mentioned in a comment above, 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/
Now Rider should see your xamarin android version.
If you have already messed up, I suggest to unistall dotnet core and mono and restart
Good luck!
Hello,
I tried following this guide but the https://jenkins.mono-project.com/ is not reachable so I can't get the xamarin.Android binary which is an important part of this guide If I'm not wrong.
is there anywhere else I can this binary, even an older version would be nice.
I'm running ubuntu 16.04 btw
update: nvm, it's working now :D
Hi Guys,
I`ve downloaded xamarin-android/xa-build-status-v9.2.99.172_Linux-x86_64_master_d33bbd8e-Debug.tar.bz2 from https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-linux/lastSuccessfulBuild/Azure/ but the content of the archive is different to this guide.
I don know, what to do with it. It's bin/build-debug and there are a lot of .binlog files. Should I just take this path instead of "
bin/Debug/lib/xamarin.android/.
"?I've tried the .deb package but Rider still shows "Xamarin Android SDK is not found".
I have followed every instruction the best I can but the IDE seems to have changed since this was posted. After completing all of the steps I can see the option option to create a xamarin library, application or unit test but it will always say that the Android SDK is not found and the create button is always grayed out. I have confirmed that the android SDK and NDK are available and also have installed the xamarin.android packages about 100 times now and this problem will not go away. It appears that the newest version of rider will not allow you to create a xamarin project period and I can't find a way to install the previous version of rider used in this example. If anyone has any suggestions, please let me know. If I can't get this to work, i will have to use different development tools
Hi guys,
I have a few issues with configuration Xamarin for Rider in Linux ...
There is not such folders as
mandroid
MonoAndroidToolsDirectory = /usr/lib/mono/mandroid
Also there is not such folder as
xamarin-android
in/usr/lib/mono
MonoAndroidBinDirectory = /usr/lib/mono/xamarin-android/bin
Seems like your instruction is not completely valid ...
Could you please fix the instruction ?
Is it possible to update this guide, I can't get it to work either...
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-8-amd64
Architecture: x86-64
JetBrains Rider 2019.3.4
Build #RD-193.6494.48, built on February 27, 2020
Runtime version: 11.0.5+10-b520.38 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.19.0-8-amd64
GC: ParNew, ConcurrentMarkSweep
Memory: 1450M
Cores: 8
Registry: ide.tree.horizontal.default.autoscrolling=false, performance.watcher.sampling.interval.ms=200, show.diff.preview.as.editor.tab=true, ide.borderless.title.product=false, performance.watcher.unresponsive.interval.ms=1000, ide.tooltip.initialDelay.highlighter=0, search.everywhere.settings=true, parameter.info.max.visible.rows=10, ide.win.file.chooser.native=true, ide.borderless.title.project.path=false, actionSystem.fix.alt.gr=false, search.everywhere.pattern.checking=false, ide.tooltip.initialDelay=0, ide.borderless.title.classpath=false, ide.require.transaction.for.model.changes=false, vcs.non.modal.commit.toggle.ui=false
Non-Bundled Plugins: com.jetbrains.rider.android
dotnet --list-sdks
1.1.14 [/usr/share/dotnet/sdk]
2.1.803 [/usr/share/dotnet/sdk]
2.2.402 [/usr/share/dotnet/sdk]
3.1.101 [/usr/share/dotnet/sdk]
mono --version
Mono JIT compiler version 5.18.0.240 (Debian 5.18.0.240+dfsg-3 Wed Apr 17 16:37:36 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
Suspend: preemptive
GC: sgen (concurrent by default)
using: android-oss_v9.2.99.172_Linux-x86_64_master_d33bbd8e-Release
java --version
openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1deb10u1, mixed mode, sharing)
Hi there,
Unfortunately, we don’t have resources to investigate what has been changed in the last Xamarin.Android Versions for Linux. Therefore, we have no plans to update this article in the nearest future.
Thank you for your understanding.
Kind regards,
Sofia.
Same problem here, unable to develop Xamarin Forms with Ubuntu 20.04 in Rider. No useful guide, steps described didn't work, Rider always complains that Android SDK is not found although it's there.
Very disappointed with the support to be honest. I'm installing Windows 10 alongside Ubuntu just to develop with Visual Studio.
Let me help you with that.
I did a clean install yesterday and doing some work right now.
https://github.com/Crashdummyy/XamarinRiderDev
This article works on my Fedora 33 machine, but only with emulator.
dotnet is just installed from dnf
mono - latest, installed from official website
openjdk-1.8 with devel package installed from dnf
and I have downloaded "Linux Packages" from here: https://dev.azure.com/xamarin/public/_build/results?buildId=35046&view=artifacts&pathAsName=false&type=publishedArtifacts
Also, some links was used: https://github.com/xamarin/xamarin-android
I made a simple step-by-step guide, mostly for myself for future reference, but maybe it's also usefull for others:
https://github.com/Flying--Dutchman/RiderXamarinAndroid/blob/main/README.md
Works on my Manjaro (Arch linux) system.
Please, see https://youtrack.jetbrains.com/issue/RIDER-5747 in Rider tracker to see the current status of the support and do not hesitate to upvote.