Debugging vs-android projects with VisualGDB
This tutorial explains how to debug native Android projects made with vs-android in Visual Studio
- First ensure that your vs-android project can be built properly. If you cannot make it work, please consider using VisualGDB Project wizard instead. In this tutorial we will use the san-angeles project from the vs-android samples.
- Download the latest VisualGDB. If you are using custom installation, ensure that Android Edition is selected for installation:
- Open Visual Studio, click at Android->Setup SDK/NDK locations. Enter the locations of your Android tools or use the "Detect" buttons to try detecting them automatically:
- Open your vs-android project (in this example we use the
san-angeles sample). Open the
AndroidManifest.xml file inside the AndroidApk
folder and set the android:debuggable attribute to "true":<application android:label="@string/app_name"
<!-- Your activities are listed here -->
- In this tutorial we set a breakpoint inside the drawGLObject() function. You can set breakpoints anywhere in the code before and during debugging, just like in normal Visual Studio projects.
- Select Android->Debug Android App in Visual Studio:If the debug commands are not displayed, please select your project as startup project in the solution.
- If you encounter a message about inconsistent signature, please use the Android->Remove App from device command.
- If you are debugging the project for the first time, VisualGDB will detect that gdbserver is missing and suggest auto-installing it. Please click "yes", then rebuild your project with Build->Rebuild Solution. If you do not rebuild the solution, gdbserver will not be put inside the apk file and debugging won't be possible.
- Click Android->Debug Android App again. VisualGDB will begin deploying your project and preparing the debugging session:
- If you have previously set a breakpoint at a location that gets executed, your breakpoint will be triggered:
Congratulations! You can now debug your app. You can also setup Visual Studio to use the original NDK build system by following this tutorial.
|Follow @sysprogs Tweet|