Description
Android framework version
net9.0-android
Affected platform version
VS 17.12.2, SDK 9.0.100, Windows 11 24H2
Description
The system compiles the code and sends it to the Android phone, however, after generating the .apk package in the system correctly, Visual Studio does not allow me to debug it.
I can open the generated package on my cell phone without errors, but I cannot debug it using 'hot reload' in any way.
Cell phone model: Motorola G(8)
Android Version: Android 10
Detail, on the same machine I have another application developed in Xamarin for the same cell phone, and I can debug it normally.
Steps to Reproduce
Video Error:
https://github.com/user-attachments/assets/4260e896-6c6a-4fd8-9101-87aff3ee9893
1 - Start Visual Studio
2 - Create a New Project
3 - .NET MAUI App (name: ExemploAndroid)
4 - Net 9
('include sample content' NOT selected)
Change the file 'ExemploAndroid.csproj' to:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->
<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
<OutputType>Exe</OutputType>
<RootNamespace>ExemploAndroid</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- Display name -->
<ApplicationTitle>ExemploAndroid</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.exemploandroid</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
<WindowsPackageType>None</WindowsPackageType>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">28.0</SupportedOSPlatformVersion>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">android-arm;android-arm64;android-x86;android-x64;</RuntimeIdentifiers>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0-android|AnyCPU'">
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<!--<AndroidSupportedAbis>true</AndroidSupportedAbis>-->
<!-- <AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi>-->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0-android|AnyCPU'">
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<!-- <AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi>-->
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
</ItemGroup>
</Project>
Plug in your cell phone (already configured in developer mode), choose to debug and after deployment, Visual Studio stops debugging.
Did you find any workaround?
unfortunately not.
Relevant log output
Build started at 21:20...
1>------ Build started: Project: ExemploAndroid, Configuration: Debug Any CPU ------
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>Including assemblies for Hot Reload support
1>ExemploAndroid -> C:\Users\workc\source\repos\ExemploAndroid\bin\Debug\net9.0-android\ExemploAndroid.dll
2>------ Deploy started: Project: ExemploAndroid, Configuration: Debug Any CPU ------
2>Starting deployment to Motorola moto g(8) play ...
2>Deploying to Motorola moto g(8) play ...
Build started.
Project "ExemploAndroid.csproj" (Install target(s)):
There is no application host available for the specified RuntimeIdentifier 'android-arm'.
There is no application host available for the specified RuntimeIdentifier 'android-arm64'.
There is no application host available for the specified RuntimeIdentifier 'android-x86'.
There is no application host available for the specified RuntimeIdentifier 'android-x64'.
Found Java SDK version 17.0.12.
MonoAndroid Tools: c:\program files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\
Android Platform API level: 35
TargetFrameworkVersion: v9.0
Android NDK:
Android SDK: C:\Program Files (x86)\Android\android-sdk\
Android SDK Build Tools: C:\Program Files (x86)\Android\android-sdk\build-tools\35.0.0\
Java SDK: C:\Program Files (x86)\Android\openjdk\jdk-17.0.12\Application Java class: android.app.Application
_OuterIntermediateOutputPath: IntermediateOutputPath: obj\Debuget9.0-android\
Skipping target "ProcessMauiSplashScreens" because all output files are up-to-date with respect to the input files.
Skipping target "ProcessMauiFonts" because all output files are up-to-date with respect to the input files.
Skipping target "ResizetizeImages" because all output files are up-to-date with respect to the input files.
Skipping target "_ResolveLibraryProjectImports" because all output files are up-to-date with respect to the input files.
Skipping target "_BuildLibraryImportsCache" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateResourceCaseMap" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateResourceDesignerIntermediateClass" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateLayoutBindings" because it has no outputs.
Skipping target "_ConvertResourcesCases" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileResources" because all output files are up-to-date with respect to the input files.
Skipping target "_PrepareUpdateAndroidResgen" because all output files are up-to-date with respect to the input files.
Skipping target "_UpdateAndroidResgen" because all output files are up-to-date with respect to the input files.
Project "ExemploAndroid.csproj" (_ComputeFilesToPublishForRuntimeIdentifiers target(s)):
There is no application host available for the specified RuntimeIdentifier 'android-arm'.
There is no application host available for the specified RuntimeIdentifier 'android-arm64'.
There is no application host available for the specified RuntimeIdentifier 'android-x86'.
There is no application host available for the specified RuntimeIdentifier 'android-x64'.
_OuterIntermediateOutputPath: obj\Debuget9.0-android\IntermediateOutputPath: obj\Debuget9.0-android\android-arm\
Done building project "ExemploAndroid.csproj".
Project "ExemploAndroid.csproj" (_ComputeFilesToPublishForRuntimeIdentifiers target(s)):
There is no application host available for the specified RuntimeIdentifier 'android-arm'.
There is no application host available for the specified RuntimeIdentifier 'android-arm64'.
There is no application host available for the specified RuntimeIdentifier 'android-x86'.
There is no application host available for the specified RuntimeIdentifier 'android-x64'.
_OuterIntermediateOutputPath: obj\Debuget9.0-android\IntermediateOutputPath: obj\Debuget9.0-android\android-arm64\Done building project "ExemploAndroid.csproj".
Project "ExemploAndroid.csproj" (_ComputeFilesToPublishForRuntimeIdentifiers target(s)):
There is no application host available for the specified RuntimeIdentifier 'android-arm'.
There is no application host available for the specified RuntimeIdentifier 'android-arm64'.
There is no application host available for the specified RuntimeIdentifier 'android-x86'.
There is no application host available for the specified RuntimeIdentifier 'android-x64'.
_OuterIntermediateOutputPath: obj\Debuget9.0-android\IntermediateOutputPath: obj\Debuget9.0-android\android-x86\Done building project "ExemploAndroid.csproj".
Project "ExemploAndroid.csproj" (_ComputeFilesToPublishForRuntimeIdentifiers target(s)):
There is no application host available for the specified RuntimeIdentifier 'android-arm'.
There is no application host available for the specified RuntimeIdentifier 'android-arm64'.
There is no application host available for the specified RuntimeIdentifier 'android-x86'.
There is no application host available for the specified RuntimeIdentifier 'android-x64'.
_OuterIntermediateOutputPath: obj\Debuget9.0-android\IntermediateOutputPath: obj\Debuget9.0-android\android-x64\Done building project "ExemploAndroid.csproj".
Skipping target "_LinkAssembliesNoShrink" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateJavaStubs" because all output files are up-to-date with respect to the input files.
Skipping target "_ManifestMerger" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertCustomView" because all output files are up-to-date with respect to the input files.
Skipping target "_AddStaticResources" because all output files are up-to-date with respect to the input files.
Skipping target "_GeneratePackageManagerJava" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateAndroidAssetsDir" because all output files are up-to-date with respect to the input files.
Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileNativeAssemblySources" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateApplicationSharedLibraries" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileToDalvik" because all output files are up-to-date with respect to the input files.
Deleting file "bin\Debuget9.0-android\com.companyname.exemploandroid.apk".
Copying file from "C:\Users\workc\source\repos\ExemploAndroid\obj\Debug
et9.0-android\android\bin\com.companyname.exemploandroid.apk" to "C:\Users\workc\source\repos\ExemploAndroid\bin\Debug
et9.0-android\com.companyname.exemploandroid.apk".
Touching "obj\Debug
et9.0-android\android_debug_keystore.flag".
Deleting file "C:\Users\workc\source\repos\ExemploAndroid\bin\Debug
et9.0-android\com.companyname.exemploandroid-Signed.apk".
C:\Program Files (x86)\Android\android-sdk\build-tools\35.0.0\zipalign.exe -p 16 "obj\Debug
et9.0-android\android\bin\com.companyname.exemploandroid.apk" "bin\Debug
et9.0-android\\com.companyname.exemploandroid-Signed.apk"
C:\Program Files (x86)\Android\openjdk\jdk-17.0.12\bin\java.exe -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\35.0.0\lib\apksigner.jar" sign --ks "C:\Users\workc\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 28 --max-sdk-version 35 bin\Debug
et9.0-android\com.companyname.exemploandroid-Signed.apk
Signed android package 'bin\Debug
et9.0-android\com.companyname.exemploandroid-Signed.apk'
Using cached value from RegisterTaskObject
Found device: 0062963070
Forwarding debugger port 8805
Detecting existing process
> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.companyname.exemploandroid/crc64358cda76bdc6f75f.MainActivity"
> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.companyname.exemploandroid/crc64358cda76bdc6f75f.MainActivity }
[.exemploandroi] Late-enabling -Xcheck:jni
[.exemploandroi] Unknown bits set in runtime_flags: 0x8000
[DOTNET] AndroidCryptoNative_InitLibraryOnLoad: jint AndroidCryptoNative_InitLibraryOnLoad(JavaVM *, void *) in /__w/1/s/src/native/libs/System.Security.Cryptography.Native.Android/pal_jni.c
[DOTNET] GetOptionalClassGRef: optional class com/android/org/conscrypt/OpenSSLEngineImpl was not found
[monodroid] Failed to create directory '/data/user/0/com.companyname.exemploandroid/files/.__override__/armeabi-v7a'. No such file or directory
[monodroid] Creating public update directory: `/data/user/0/com.companyname.exemploandroid/files/.__override__/armeabi-v7a`
[.exemploandroi] Attempt to remove non-JNI local reference, dumping thread
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8805,server=y,embedding=1,timeout=8
[monodroid-assembly] Unable to open app library directory '/data/user/0/com.companyname.exemploandroid/files/.__override__/armeabi-v7a': No such file or directory
[mono] Listening on 127.0.0.1:8805 (timeout=8 ms)...
[mono] debugger-agent: Timed out waiting to connect.