-
Notifications
You must be signed in to change notification settings - Fork 382
detect ANDROID_SDK_ROOT #5502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
detect ANDROID_SDK_ROOT #5502
Conversation
/cc @jonathanpeppers |
a51fcf6
to
2656299
Compare
2656299
to
c85f725
Compare
5c54760
to
c392e45
Compare
I verified the new dependency is already trim/aot compatible: |
//ANDROID_SDK_ROOT is deprecated | ||
string sdkRoot = Environment.GetEnvironmentVariable("ANDROID_HOME") ?? Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT") ?? new AndroidSdkInfo(logger: sdklogger).AndroidSdkPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this...
If $ANDROID_SDK_ROOT
is deprecated, we can probably remove it and all mention of this env var. And we should add a new command-line switch to set this path? This could be a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much of this logic is encoded directly into AndroidSdkPath? Maybe it already has logic to check the correct env variables supported by the Android SDK?
When we update this, we should update any documentation that reference the deprecated env variable.
+1 on having a separate optional argument passed to dsrouter, should work when using android profiles or using the forward port argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, AndroidSdkInfo
checks the environment variables anyway:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, then we should probably drop the env checks here altogether and rely on AndroidSdkPath to provide it.
<Dependency Name="Xamarin.Android.Tools.AndroidSdk" Version="1.0.105-preview.225"> | ||
<Uri>https://github.com/dotnet/android</Uri> | ||
<Sha>bf304cf475308547a2a1a342bb9f2e6825cc33cd</Sha> | ||
</Dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably always going to be "preview" branded and marked as a non-shipping/transport package.
We could track with a subscription, but you probably don't need to update this frequently.
I can manage updating it manually when it matters, such as: > darc update-dependencies --id 276447
@@ -166,7 +187,7 @@ public override void Start() | |||
_ownsPortReverse = false; | |||
Logger.LogError("Failed setting up adb port reverse." + | |||
" This might lead to problems communicating with Android application." + | |||
" Make sure env variable ANDROID_SDK_ROOT is set and points to an Android SDK." + | |||
" Make sure env variable $ANDROID_HOME is set and points to an Android SDK." + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably update our docs as well, https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dsrouter, it reference ANDROID_SDK_ROOT as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one updates the docs to match this PR:
Context: https://developer.android.com/tools/variables Context: dotnet/diagnostics#5502 PR #5502 is adding support to "automatically" find the Android SDK as installed by other tools like Visual Studio, Android Studio, etc. `$ANDROID_SDK_ROOT` is also deprecated, so updating any messages to mention `$ANDROID_HOME` instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Context: https://developer.android.com/tools/variables Context: dotnet/diagnostics#5502 PR #5502 is adding support to "automatically" find the Android SDK as installed by other tools like Visual Studio, Android Studio, etc. `$ANDROID_SDK_ROOT` is also deprecated, so updating any messages to mention `$ANDROID_HOME` instead.
this is a draft, as it depends on non-official nuget
Detect the current ANDROID_SDK_ROOT and pick the right
adb
tool