{"id":102,"date":"2015-04-17T15:07:08","date_gmt":"2015-04-17T15:07:08","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=102"},"modified":"2015-07-19T08:33:53","modified_gmt":"2015-07-19T15:33:53","slug":"android-vs-android","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/android\/vs-android\/","title":{"rendered":"Debugging vs-android projects with VisualGDB"},"content":{"rendered":"<p>This tutorial explains how to debug native Android projects made with <strong>vs-android<\/strong> in Visual Studio<\/p>\n<ol>\n<li>First ensure that your <strong>vs-android<\/strong> project can be built properly. If you cannot make it work, please consider <a href=\"http:\/\/visualgdb.com\/tutorials\/android\/vs-android\/..\/\">using VisualGDB Project wizard<\/a> instead. In this tutorial we will use the san-angeles project from the vs-android samples.<\/li>\n<li><a href=\"\/download\">Download<\/a> the latest VisualGDB. If you are using custom installation, ensure that Android Edition is selected for installation:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/00-install.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/00-install.png\" alt=\"00-install\" width=\"509\" height=\"398\" \/><\/a><\/li>\n<li>Open Visual Studio, click at Android-&gt;Setup SDK\/NDK locations. Enter the locations of your Android tools or use the &#8220;Detect&#8221; buttons to try detecting them automatically:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/01-tools.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/01-tools.png\" alt=\"01-tools\" width=\"640\" height=\"262\" \/><\/a><span class=\"warning\">If you want to debug your vs-android projects with F5, you need to enable this feature here by pressing &#8220;Add Support&#8221;.<\/span><\/li>\n<li>Open your vs-android project (in this example we use the <strong>san-angeles<\/strong> sample). Open the <strong> AndroidManifest.xml <\/strong>file inside the AndroidApk folder and set the android:debuggable attribute to &#8220;true&#8221;:\n<pre> &lt;application android:label=\"@string\/app_name\"\r\n              android:debuggable=\"true\"&gt;\r\n   &lt;!-- Your activities are listed here --&gt;\r\n&lt;\/application&gt;<\/pre>\n<\/li>\n<li>In this tutorial we set a breakpoint inside the <strong> drawGLObject()<\/strong> function. You can set breakpoints anywhere in the code before and during debugging, just like in normal Visual Studio projects.<\/li>\n<li>Select Android-&gt;Debug Android App in Visual Studio:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/02-debugapp.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/02-debugapp.png\" alt=\"02-debugapp\" width=\"700\" height=\"545\" \/><\/a><span class=\"warning\">If the debug commands are not displayed, please select your project as startup project in the solution.<br \/>\n<strong>Important note:<\/strong> VisualGDB 5.0+ supports clang-based IntelliSense for vs-android projects. Read more in <a href=\"http:\/\/visualgdb.com\/tutorials\/android\/vs-android\/intellisense\/\">this tutorial<\/a>.<\/span><\/li>\n<li>If you encounter a message about inconsistent signature, please use the Android-&gt;Remove App from device command.<\/li>\n<li>If you are debugging the project for the first time, VisualGDB will detect that gdbserver is missing and suggest auto-installing it. Please click &#8220;yes&#8221;, then <strong>rebuild your project with Build-&gt;Rebuild Solution<\/strong>. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/03-gdbserver.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/03-gdbserver.png\" alt=\"03-gdbserver\" width=\"486\" height=\"174\" \/><\/a><span class=\"warning\">If you do not rebuild the solution, gdbserver will not be put inside the apk file and debugging won&#8217;t be possible.<\/span><\/li>\n<li>Click Android-&gt;Debug Android App again. VisualGDB will begin deploying your project and preparing the debugging session:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/05-launching.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/05-launching.png\" alt=\"05-launching\" width=\"700\" height=\"545\" \/><\/a><\/li>\n<li>If you have previously set a breakpoint at a location that gets executed, your breakpoint will be triggered:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/06-debugging.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/06-debugging.png\" alt=\"06-debugging\" width=\"700\" height=\"545\" \/><\/a><\/li>\n<li>Go to Project Properties, select Debugging page and ensure that you have VisualGDB Android Debugger selected:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/07-defaultdbg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/07-defaultdbg.png\" alt=\"07-defaultdbg\" width=\"700\" height=\"497\" \/><\/a><span class=\"warning\">Note that the Android Debugger won&#8217;t appear in the list unless you enable it from the Setup NDK\/SDK locations dialog.<\/span><\/li>\n<li>You can configure VisualGDB-specific settings for your vs-android projects by right-clicking on the project and selecting VisualGDB Project Properties:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/08-vgdbsettings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/vs-android\/08-vgdbsettings.png\" alt=\"08-vgdbsettings\" width=\"700\" height=\"493\" \/><\/a><\/li>\n<\/ol>\n<p>Congratulations! You can now debug your app. You can also setup Visual Studio to use the original NDK build system by <a href=\"\/tutorials\/android\/\"><span class=\"auto-style1\"> following this tutorial<\/span>.<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial explains how to debug native Android projects made with vs-android in Visual Studio First ensure that your vs-android<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[31,48],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/102"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"predecessor-version":[{"id":184,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/102\/revisions\/184"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}