You may need to run Android Studio and Xamarin side by side from time to time. This may be needed if you are an Android developer experimenting with Xamarin or maybe you are migrating an Android application to Xamarin. I run the two side by side often especially when I am binding native libraries for Xamarin. I put together a guide to make the new Xamarin Cycle 9 release and Android Studio 2.2.3 run together without any pain and also without wasting disk space with multiple copies of Android Sdks. I also find it’s much cleaner to install everything manually without the installers. This guide is specifically aimed for Windows and Visual Studio 2015+ users.
Install Java JDK 1.8 x64 (Use the latest update of this available)http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Install the Android NDK
The NDK is a zip file. Extract this to a location that’s easily accessible: C:\AndroidSDK\android-ndk-r13b-windows-x86_64
- Android NDK installation download: https://developer.android.com/ndk/downloads/index.html
Install the Android SDK
The simplest and cleanest is to install the command line version of the SDK
Android SDK Command line installation: https://dl.google.com/android/repository/tools_r25.2.3-windows.zip
This is just a zip file not requiring any installation. Extract the contents to a location that’s easily accessible. Eg. C:\AndroidSDK\tools_r25.2.3-windows
Install the required SDK Tools and APIs
From command line execute <Android SDK>\tools\android This will open the SDK manager.
Install Android SDK tools 25.2.5
Install Android SDK platform tools 25.0.3
Install Android Build tools 25.0.2
Install API 25 SDK Platform (and whichever other APIs you require)
Install “Sources for Android SDK” for API 25. Xamarin does not require this, but Android Studio will later request it be installed. This will simplify the later setup if done now.
Install Google Repository
Install Google Play Services
Install Android Support Repository
Install Xamarin for Visual Studio 4.3. If you installed Xamarin with Visual Studio 2015, you have it already. To upgrade to Cycle 9 use the Updater Channel within Visual Studio. Alternatively if you don’t have it, you can manually install it: https://store.xamarin.com/account/my/subscription/downloads. Download the individual installation package per platform (and not the universal installer). At the time of writing this there isn’t a direct link to cycle 9, so download cycle 8 and update it.
Set up the SDK paths within Visual Studio. There is a setting for both the path to the NDK and SDK previously installed. The location of the Java SDK should be set here too. Visual Studio will need to be restarted for this to take effect.
Note: If Xamarin was previously installed via the Visual Studio or the Xamarin Universal Installer. There will be another Android SDK installed. This is most likely: C:\Users\<user>\AppData\Local\Xamarin\Universal\AndroidSDK. If the steps above were followed, this previous path can be safely removed. This folder can be used to share the SDK with Android Studio, however personally I don’t think it’s a great location for doing that.
The Xamarin Cycle 9 installation is complete and should now work with the new SDK location.
Installing Android Studio 2.2.3
Download the Android Studio zip file (without installer and SDK): https://developer.android.com/studio/index.html
Extract the Android Studio Zip to any desired location eg: D:\AndroidStudio\android-studio-ide-145.3537739-windows
On first run, Android studio will start the wizard to set itself up (and download the SDK). Skip the wizard.
Choose “Settings” from the Start screen.
Specify the path previously used for the Android SDK. eg: C:\AndroidSDK\tools_r25.2.3-windows
Everything needed should already be in place, so Android Studio will accept the SDK without any problems.
Android Studio should now work fine with shared SDK with Xamarin.
Happy Xamarin and Android Coding!