Skip to content

Commit 8b62de4

Browse files
authored
[docs] Update mono android debugging docs (#99633)
1 parent be0e14c commit 8b62de4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

docs/workflow/debugging/mono/android-debugging.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,27 @@ Since you're debugging an optimized release build, it is likely the debugger wil
5757

5858
## Native debugging using a local debug build of Mono
5959

60-
Build the runtime for your android architecture: `ANDROID_NDK_ROOT=<path_to_android_ndk> ./build.sh --os android --arch x86 -c Debug`. See the instructions for [Testing Android](../../testing/libraries/testing-android.md) for details.
60+
Ensure the prerequisites are met for [Testing Android](../../testing/libraries/testing-android.md#prerequisites).
6161

62+
Build the runtime for your android architecture `<ANDROID_ARCH>` and keep debug symbols in the binary:
6263

63-
In the source code for the C# project, add the following to the .csproj (replacing `<RUNTIME_GIT_ROOT>` by the appropriate location):
64+
`./build.sh -s mono+libs -os android -arch <ANDROID_ARCH> -c Debug /p:KeepNativeSymbols=true`
65+
66+
In the source code for the C# project, add the following to the .csproj (replacing `<RUNTIME_GIT_ROOT>` by the appropriate location and `<ANDROID_ARCH>` with the built android architecture):
6467

6568
```
6669
<Target Name="UpdateRuntimePack"
6770
AfterTargets="ResolveFrameworkReferences">
6871
<ItemGroup>
69-
<ResolvedRuntimePack PackageDirectory="<RUNTIME_GIT_ROOT>/artifacts/bin/microsoft.netcore.app.runtime.android-x86/Debug"
72+
<ResolvedRuntimePack PackageDirectory="<RUNTIME_GIT_ROOT>/artifacts/bin/microsoft.netcore.app.runtime.android-<ANDROID_ARCH>/Debug"
7073
Condition="'%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App'" />
7174
</ItemGroup>
7275
</Target>
7376
```
7477

75-
Then rebuild and reinstall the project, open the apk in Android Studio, and debug. The
76-
runtime native libraries will be stripped, so to make use of debug symbols, you
77-
will need to follow the steps above (rename `*.so.dbg` in the artifacts to
78-
`*.so.so` and add them to the APK project in Android Studio)
78+
Then rebuild and reinstall the project, open the apk in Android Studio (File > Profile or Debug APK), and debug.
79+
80+
Note: If debugging in Android Studio stops at signals `SIGPWR` and `SIGXCPU` during startup, configure LLDB to not stop the process for those signals via `process handle -p true -s false -n true SIGPWR` and `process handle -p true -s false -n true SIGXCPU` in Android Studio's LLDB tab.
7981

8082
## Native and managed debugging or debugging the managed debugger
8183

0 commit comments

Comments
 (0)