Skip to content

A fresh install of Android and VS Code fails #8522

@mattleibow

Description

@mattleibow

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

All

Description

I just did a fresh install of VS Code and tried to build an Android app. I followed the instructions to set up Java and the Android SDK. VSCode can build the app, but dotnet build does not.

It fails because it can't find the sdk because I have not set AndroidSdkDirectory. I never set that for builds when using full VS.

I tried setting the correct ANDROID_SDK_ROOT and ANDROID_HOME envvars, but nothing changes.

The output of dotnet build -t:InstallAndroidDependencies -f:net8.0-android also does not say anything. It would be nice if the SDK could be automatically picked up using the default/accepted envvars and not require a .NET-specific setting.

Steps to Reproduce

  1. Clean VS/Sandbox
  2. Install MAUI Dev Kit
  3. Install Java and Android SDK following the directions
  4. Run dotnet build
  5. Observe the error
  6. Run using F5
  7. Observe no error

Did you find any workaround?

Setting an envvar AndroidSdkDirectory to my SDK. This is not really expected and no mention in the docs. I just know to set it because I know MSBuild also checks envvars.

Relevant log output

No response

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions