27

When I am installing Visual Studio 2015 I realized that it says Java SE Development Kit is already exists on the computer. I think installer knew it because of environment variables. That's why I set ANDROID_SDK_HOME and ANDROID_NDK environment variables.

But when I launch the installer again it is still aware of only Java Development Kit.

Do I set wrong environment names? How to make the installer know that I already have SDK and NDK?

Jordan Matthiesen
  • 1,480
  • 7
  • 17
zgrkpnr89
  • 325
  • 1
  • 6
  • 17
  • There's no way to tell it or it know that you have NDK installed without searching your entire computer. It's just a self extracting zip file that doesn't set any environment variables, modify the registry or anything. However it was able to detect that I already had the SDK installed because the SDK is installed like normal application that you can uninstall from the control panel. Try rerunning the .EXE installer for the SDK. If you downloaded the ZIP file and unpacked that then you'll run into the same problem as the NDK. – Ross Ridge Aug 03 '15 at 16:59
  • So, I need to let it download again? – zgrkpnr89 Aug 03 '15 at 18:00
  • If you use the EXE installer for the SDK it might be smart enough to not redownload any existing files if you point it at the same place you previously installed/unzipped the SDK to. But probably not. – Ross Ridge Aug 03 '15 at 18:33

4 Answers4

38

Visual Studio 2015 installer doesn't use ANDROID_SDK_HOME environment variable to detect SDK. You have to create the following registry entry.

enter image description here

  • Open REGEDIT and navigate to HKEY_LOCAL_MACHINE\SOFTWARE. You have to add new key Android SDK Tools (if not already present) by right clicking SOFTWARE.

  • Now add a new String Value Path by right clicking Android SDK Tools and enter path of android sdk as its value

I have tested it and visual studio 2015 installer successfully detected my existing Android SDK

Reference: https://bugzilla.xamarin.com/show_bug.cgi?id=859#c18

Abdul Rauf
  • 5,798
  • 5
  • 50
  • 70
  • 2
    This fixed my problem when Xamarin Installer couldn't detect an existing Android SKD. – Vahid Amiri Apr 01 '16 at 11:02
  • 3
    But what about the NDK? – Ray Apr 04 '16 at 14:02
  • @Miro VS do not need to find java because finding java is responsibility of Android SDK. – Abdul Rauf Apr 19 '16 at 04:41
  • 3
    @AbdulRaufMujahid: thanks much, it works! Moreover, how to apply the same with the others such as `Android SDK Setup (API level 19 and 21)`, `Android SDK Setup (API level 23)`...? – BNK May 02 '16 at 06:47
  • @BNK visual studio will detect API levels if they are installed in your Android SDK. – Abdul Rauf May 02 '16 at 10:39
  • 2
    @AbdulRaufMujahid I installed all of them before, with Android Studio, however, VS still cannot detect – BNK May 02 '16 at 10:50
  • @BNK, did you found how to let VS2015 detect SDK Setup 19,21,23? – qakmak May 13 '16 at 18:38
  • @qakmak no, so I still installed, actually at the end of installation, it displayed all these SDK APIs failed. However, I can use VS to develop Android and Cross Platform apps successfully – BNK May 13 '16 at 22:22
  • 2
    Worth noting this also fixed an issue for me where adb wouldn't connect to VS emulator device – Adam H Jul 04 '16 at 15:58
  • for x64 versions of Windows the key is HKLM:\SOFTWARE\Wow6432Node\Android SDK Tools – Blindfold Nov 06 '17 at 07:38
8

in installer, uncheck downloading android SKDs and let visual studio install completely, then in visual studio go to Tools -> Options -> Xamarin -> Android setting, locate your SDK's path in "Android SDK Location" and locate your NDK's path in "Android NDK location".

Pourya8366
  • 3,424
  • 4
  • 21
  • 28
  • 6
    Visual studio 2015 installer won't allow the installation of xamarin if we uncheck Android SDK. And without installing xamarin, how can we navigate to Tools -> Options -> Xamarin -> Android setting ? – Abdul Rauf Sep 18 '15 at 18:49
  • Sorry... I don't know that. – Pourya8366 Sep 20 '15 at 15:19
3

I could do it by going to:

Tools->Options->Tools for Apache Cordova->Environment Variable Overrides

Then putting the Android SDK Path into ADT_HOME variable(you must check the box first)

Default SDK path is:

C:\Users\ {YOUR USER} \AppData\Local\Android\sdk

Android SDK and ADT are different things, but Visual Studio could find the SDK this way.

2

It's worth a try:

Open Registry Editor by selecting Run from the Start buttons context menu, typing regedit in the dialog box, and choosing OK. Navigate to

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools

in the folder tree on the left. Modify the Path registry variable to match the path to your Android SDK. Restart the emulator and you should now be able to see the emulator connected to ADB and associated Android tools.

If it's not there you will have to create the Android Sdk Tools key in Wow6432Node

with the value C:\Users\myUserName\AppData\Local\Android\sdk

Source:

https://msdn.microsoft.com/en-us/library/mt228282.aspx