.NET MAUI cannot find Android emulators on Mac OS 15

Wei Wen 1,126 Reputation points
2024-10-28T20:06:01.9466667+00:00

I recently updated Mac OS to Sequoia (15). After I opened my .NET MAUI project in VS Code and waited for all checks to finish, I selected ".NET MAUI: Pick Android Device" from Command Palette, but there was nothing for me to choose from. I have created one Android emulator from Android Studio. Choosing Android devices used to work before the Mac OS update.

I have Cisco Secure Client enabled. So I think it may have something to do with that too.

For a Flutter project that I tested, I also couldn't run Android. There the issue was that somehow the adb could not start when APN was enabled. This was shown when running flutter doctor. But if I ran "ADB_MDNS_OPENSCREEN=0 adb start-server" on the command line before I ran flutter, the problem was solved. In .NET MAUI, this does not solve the problem, and there are no error logs.

Developer technologies .NET .NET MAUI
{count} vote

1 answer

Sort by: Most helpful
  1. Wei Wen 1,126 Reputation points
    2024-11-03T22:46:41.7233333+00:00

    The part of my csproj file that caused my Android emulator to not appear is this:
    <PropertyGroup>

    <PlatformTarget>AnyCPU</PlatformTarget>

    <TargetFrameworks>net8.0-ios</TargetFrameworks>

    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>

    <CodesignKey>Apple Development: XXX</CodesignKey>

    <CodesignProvision>MauiDemoApp</CodesignProvision>

    <CodesignEntitlements>Platforms/iOS/Entitlements.plist</CodesignEntitlements>

    </PropertyGroup>

    The real problem is in <TargetFrameworks>net8.0-ios</TargetFrameworks>. That invalidated all previously allowed target frameworks. Also some were already set at the start of the csproj. So The above block was changed to this and it solved my problem:
    <PropertyGroup Condition="'$(TargetFramework)' == 'net8.0-ios'">

    <CodesignKey>Apple Development: XXX</CodesignKey>

    <CodesignProvision>MauiDemoApp</CodesignProvision>

    <CodesignEntitlements>Platforms/iOS/Entitlements.plist</CodesignEntitlements>

    </PropertyGroup>

    In addition, I also have to do this at command line:
    ADB_MDNS_OPENSCREEN=0 adb start-server

    If I don't do this, adb server will not be able to start and the android environment analysis will run forever without been able to output the result which I showed you earlier.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.