Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Are Environment Variables with VS Xamarin broken on Mac?

$
0
0

I have a simple Xamarin.Forms test application that I am developing with Visual Studio for Mac v8.1.3 which I am running on a Mac Mini with macOS Mojave v10.14.4. For my UITest application, I need access to the Android adb application.

The Android bundle installed properly and Visual Studio can deploy and run my app in the Android emulator.

When I open a Mac Terminal bash window, I can type in env and see a list of environment variables. In particular, it lists the ANDROID_HOME variable, which I need.

$ env
ANDROID_HOME=/Users/myusername/Library/Developer/Xamarin/android-sdk-macosx

Since I need this information, I tried to get it in UITest using the .NET Environment.GetEnvironmentVariable("ANDROID_HOME") method. It returns nothing.

When I enumerate all the available environment variables from Environment.GetEnvironmentVariables(), the items returned do not reflect the default variables available in the Terminal window.

According to the .NET documentation, docs.microsoft.com/en-us/dotnet/api/system.environment.getenvironmentvariables?view=netframework-4.8 (sorry, I haven't been around long enough to post the entire link), this method only supports Process environment variables.

On macOS and Linux, only a target value of EnvironmentVariableTarget.Process is supported. Per-process environment variables are inherited from the parent process (typically the shell) used to launch the dotnet process or are defined within the scope of the dotnet process itself.

Does Visual Studio for Mac not have access to the default environment variables in the Bash shell?

If VS for Mac can launch the Android emulator, deploy the application, and debug it interactively, is there an easy way to programmatically access the Android SDK location that VS is using at runtime?


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>