1

I prepared a PC for CI pipelines for Xamarin projects and I installed Visual Studio Build tools only, with Mobile Development workload. The problem is I want to use the default ANDROID_SDK_HOME directory for xamarin builds but, I wasn't able to find a way to do so without Visual Studio. Every example Ive found in the web is to configure it though VS GUI as this. Do someone know where is the file where the Xamarin.Android default configuration can be changed. Or is there a way to change it though Command Line?

I'm grateful in advance.

LoLance
  • 25,666
  • 1
  • 39
  • 73
YadirHB
  • 168
  • 14

2 Answers2

0

Open up registry editor and search for AndroidSdkDirectory, the path should be something like this:

Computer\HKEY_CURRENT_USER\Software\Xamarin\VisualStudio\16.0_SOMETHING\Android

Hint: you should see JavaSdkDirectory entry right after AndroidSdkDirectory

Now you can change the value of AndroidSdkDirectory and you are good to go.

If you using visual studio 2017, I think it should be 15.0_SOMETHING instead

P.S: I tested above solution and it works in VS2019

Mehdi Dehghani
  • 10,970
  • 6
  • 59
  • 64
  • I search for it in the Registry as you recommended but, since there is no actual Visual Studio installation, only the build tools, [check here](https://drive.google.com/file/d/1dLOd2IhZl-CZa5srxd30NeRH9-X7E7ds/view?usp=sharing). So, I'm stuck again. What should I do, to create the entire Xamarin files tree? – YadirHB Apr 25 '19 at 14:16
  • I think you can create that values manually, did you try that? (before any change, please create a backup of your registry) – Mehdi Dehghani Apr 25 '19 at 14:39
  • Mehdi Dehghani, I did created manually and it didn't worked. MSBuild wasn't able to find the android SDK while I was performing a NuGet restore. So sadly this is not the solution I need. – YadirHB Apr 26 '19 at 13:48
  • @YadirHB I'm afraid, I have no idea what is the solution then, I'll update my answer if I found anything helpful. – Mehdi Dehghani Apr 26 '19 at 17:42
0

The answer from Mehdi is correct on a machine where you have already opened the android tooling in some way.
Only then are the values written into the registry.
We don't usually do that on our build machines so I searched for the values to be used.

Turns out those hashvalues at the end of the version moniker ( 16.0_009bedb5).
You can find it also in the %APPDATA%\Microsoft\VisualStudio folder!

$versions = gci "$env:APPDATA\Microsoft\VisualStudio" | ?{ $_.BaseName.Length -gt 4} | Select Name

With this powershell snippet you can retrieve them easily

Schwarzie2478
  • 2,186
  • 26
  • 30