Search code examples
debuggingxamarin.androidmauiparallelsmaui-android

.NET8 MAUI Android app debugging not working on Win11/Parallels/Visual Studio 2022


I use macOS Sonoma 14.2 (Intel) and Parallels running Windows with Visual Studio 2022 17.8.3. I'd like to debug NET8 MAUI Android app launched from Visual Studio 2022 (running on Windows) on the Android emulator running on macOS. I followed steps described here. Now the app can be deployed to the emulator. However debugger hangs on splash screen (below logs from Debug session).

Start debugging Android application ...
> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.companyname.mauiapp2/crc6452f1ea43b9adf718.MainActivity"
> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.companyname.mauiapp2/crc6452f1ea43b9adf718.MainActivity }
[nyname.mauiapp2] Late-enabling -Xcheck:jni
[nyname.mauiapp2] Using CollectorTypeCC GC.
[nyname.mauiapp2] Unexpected CPU variant for x86: x86_64.
[nyname.mauiapp2] Known variants: atom, sandybridge, silvermont, goldmont, goldmont-plus, tremont, kabylake, default
[CompatibilityChangeReporter] Compat change id reported: 171979766; UID 10144; state: ENABLED
[CompatibilityChangeReporter] Compat change id reported: 242716250; UID 10144; state: ENABLED
[ApplicationLoaders] Returning zygote-cached class loader: /system_ext/framework/androidx.window.extensions.jar
[ApplicationLoaders] Returning zygote-cached class loader: /system_ext/framework/androidx.window.sidecar.jar
[ziparchive] Unable to open '/data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/base.dm': No such file or directory
[ziparchive] Unable to open '/data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/base.dm': No such file or directory
[nativeloader] Configuring clns-6 for other apk /data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/lib/x86_64:/data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/base.apk!/lib/x86_64, permitted_path=/data:/mnt/expand:/data/user/0/com.companyname.mauiapp2
[GraphicsEnvironment] Currently set values for:
[GraphicsEnvironment] angle_gl_driver_selection_pkgs=[]
[GraphicsEnvironment] angle_gl_driver_selection_values=[]
[GraphicsEnvironment] ANGLE GameManagerService for com.companyname.mauiapp2: false
[GraphicsEnvironment] com.companyname.mauiapp2 is not listed in per-application setting
[GraphicsEnvironment] Neither updatable production driver nor prerelease driver is supported.
[debug-app-helper] Checking if libmonodroid was unpacked to /data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/lib/x86_64/libmonodroid.so
[debug-app-helper] Native libs extracted to /data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/lib/x86_64, assuming application/android:extractNativeLibs == true
[debug-app-helper] Setting up for DSO lookup in app data directories
[debug-app-helper] Added filesystem DSO lookup location: /data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/lib/x86_64
[debug-app-helper] Using runtime path: /data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/lib/x86_64
[debug-app-helper] checking directory: `/data/user/0/com.companyname.mauiapp2/files/.__override__/lib`
[debug-app-helper] directory does not exist: `/data/user/0/com.companyname.mauiapp2/files/.__override__/lib`
[debug-app-helper] Checking whether Mono runtime exists at: /data/user/0/com.companyname.mauiapp2/files/.__override__/libmonosgen-2.0.so
[debug-app-helper] Checking whether Mono runtime exists at: /data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/lib/x86_64/libmonosgen-2.0.so
[debug-app-helper] Mono runtime found at: /data/app/~~hCLu-bitDpG3yh9Qu3dMAQ==/com.companyname.mauiapp2-t43XgUbfffXZqelJx7K7ww==/lib/x86_64/libmonosgen-2.0.so
[nyname.mauiapp2] Attempt to remove non-JNI local reference
[DOTNET] JNI_OnLoad: JNI_OnLoad in pal_jni.c
[DOTNET] GetOptionalClassGRef: optional class com/android/org/conscrypt/OpenSSLEngineImpl was not found
[monodroid] Creating public update directory: `/data/user/0/com.companyname.mauiapp2/files/.__override__`
[nyname.mauiapp2] Attempt to remove non-JNI local reference
[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:52981,embedding=1,timeout=1702668782

If debugger is not attached, the app can be launched. So far I've tried different configurations of RuntimeIdentifiers and Fast deployment but the app still hangs on splash screen. I also created native Android app in Android Studio and I can debug it without problem. Any idea why NET8 MAUI Android app can't be debugged?


Solution

  • You can refer to the steps of this doc: Is it possible to connect to Android emulators running on a Mac from a Windows VM?. It can fix the problem.