{"id":97,"date":"2014-02-04T17:39:32","date_gmt":"2014-02-04T17:39:32","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=97"},"modified":"2014-02-04T17:39:32","modified_gmt":"2014-02-04T17:39:32","slug":"android-quickdebug","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/android\/quickdebug\/","title":{"rendered":"Debugging Arbitrary APK Files with Visual Studio"},"content":{"rendered":"\n<p>This tutorial shows how to quickly debug an APK on an Android device without creating a separate VisualGDB project.<\/p>\n<p>Before we begin, ensure that VisualGDB 3.1 or later is installed with the Android Edition.<\/p>\n<p>In this tutorial we will use an APK file<span class=\"auto-style1\"> from the <\/span><a href=\"http:\/\/visualgdb.com\/tutorials\/android\/quickdebug\/..\">Android quickstart tutorial<\/a> project. You can use any APK file as long as it is debuggable.<\/p>\n<ol>\n<li>Start Visual Studio. Connect an Android device or start an Android Virtual Device. Go to Android-&gt;Debug a Custom APK File.<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/01-quickdebug.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/01-quickdebug.png\" alt=\"01-quickdebug\" width=\"702\" height=\"501\" \/><\/a><\/li>\n<li>Browse for the APK file to debug. You can find it in the bin directory of Android projects. Also make sure it is a debug version of the APK file, otherwise it cannot be debugged.<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/02-quickdebugwindow.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/02-quickdebugwindow.png\" alt=\"02-quickdebugwindow\" width=\"598\" height=\"366\" \/><\/a><a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/03-openapk.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/03-openapk.png\" alt=\"03-openapk\" width=\"625\" height=\"434\" \/><\/a><\/li>\n<li>Check the option boxes if relevant. Add a preset name if you want to use those settings later on as well. When done, press &#8216;Debug&#8217;.<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/03b-openapk.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/03b-openapk.png\" alt=\"03b-openapk\" width=\"598\" height=\"366\" \/><\/a><\/li>\n<li>Now VisualGDB will deploy the APK file to the Android device and start the debug session. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/04-startdebugging.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/04-startdebugging.png\" alt=\"04-startdebugging\" width=\"484\" height=\"358\" \/><\/a><\/li>\n<li>The APK has been started on the device and already the LogCat and GDB Session windows are receiving messages. Click on the &#8216;Break All&#8217; button. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/05-debugging.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/05-debugging.png\" alt=\"05-debugging\" width=\"700\" height=\"486\" \/><\/a><\/li>\n<li>Click on &#8216;Break&#8217; as that is our intention. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/06-sigint.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/06-sigint.png\" alt=\"06-sigint\" width=\"559\" height=\"317\" \/><\/a><\/li>\n<li>Once the app is paused go to the &#8216;GDB Session&#8217; window and click on the &#8216;Show a list of all source files&#8217; button. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/07-sourcebutton.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/07-sourcebutton.png\" alt=\"07-sourcebutton\" width=\"700\" height=\"486\" \/><\/a><\/li>\n<li>Choose the source file you want to put a breakpoint in. Our example project only has one source file, hence we choose this. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/08-allsources.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/08-allsources.png\" alt=\"08-allsources\" width=\"591\" height=\"395\" \/><\/a><\/li>\n<li>Set a breakpoint in the source file. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/09-breakpoint.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/09-breakpoint.png\" alt=\"09-breakpoint\" width=\"700\" height=\"619\" \/><\/a><\/li>\n<li>Trigger the breakpoint. With the quickstart example, just tap on the screen. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/10-avd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-11\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/10-avd.png\" alt=\"10-avd\" width=\"478\" height=\"428\" \/><\/a><\/li>\n<li>When the breakpoint triggers you will be able to use the normal debugging features of Visual Studio just like with other projects. <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/11-breaked.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/quickdebug\/11-breaked.png\" alt=\"11-breaked\" width=\"700\" height=\"619\" \/><\/a><\/li>\n<\/ol>\n<p><\/root><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to quickly debug an APK on an Android device without creating a separate VisualGDB project. Before<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[31],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/97"}],"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=97"}],"version-history":[{"count":0,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}