{"id":7211,"date":"2015-11-06T12:13:00","date_gmt":"2015-11-06T12:13:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2015\/11\/06\/java-debugging-and-language-support-in-visual-studio-for-android\/"},"modified":"2021-10-13T11:33:49","modified_gmt":"2021-10-13T11:33:49","slug":"java-debugging-and-language-support-in-visual-studio-for-android","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/java-debugging-and-language-support-in-visual-studio-for-android\/","title":{"rendered":"Java debugging and language support in Visual Studio for Android"},"content":{"rendered":"<p>As part of our continued efforts to make Visual Studio a productive environment for developing mobile applications we&rsquo;re pleased to announce that <a href=\"https:\/\/www.visualstudio.com\/news\/vs2015-update1-vs\">Visual Studio 2015 Update 1 RC<\/a> adds support for debugging your Java source files that are part of your Android projects and (with the help of an extension) get IntelliSense and Browsing assistance for these files in the editor.<\/p>\n<p>This blog post shows you how to get started with the newly added Java support as well as what to expect from the Visual Studio support in Update 1.&nbsp;<\/p>\n<h2>Building Java sources<\/h2>\n<p>Support for building Java files is already part of the Visual Studio 2015 RTM release. The ANT build system by default picks any .java file under the &ldquo;src&rdquo; folder for compilation. If you include these files in the Android project, they also easily participate in Visual Studio&rsquo;s built-in source control integration.<\/p>\n<p>To get started with Java into your Android project, you can do any of the following:<\/p>\n<ul>\n<li>Create a new project starting with the Basic Application template (under C++ &gt; Cross-Platform node under New Project Dialog)<\/li>\n<li>Start from <a href=\"https:\/\/code.msdn.microsoft.com\/vstudio\/site\/search?f%5B0%5D.Type=ProgrammingLanguage&amp;f%5B0%5D.Value=C%2B%2B&amp;f%5B0%5D.Text=C%2B%2B&amp;f%5B1%5D.Type=VisualStudioVersion&amp;f%5B1%5D.Value=14.0&amp;f%5B1%5D.Text=Visual%20Studio%202015&amp;f%5B2%5D.Type=Technology&amp;f%5B2%5D.Value=Android\">one of the Code Gallery Android C++ samples<\/a> that ship with Java source code<\/li>\n<li>Import an Eclipse Android project that already contains Java files (under File &gt; New &gt; Android Projects from Eclipse&hellip; menu, after installing the <a href=\"https:\/\/visualstudiogallery.msdn.microsoft.com\/53e6e65b-fa0f-411a-a98d-7911009537ac\">Java support extension<\/a>)<\/li>\n<li>Place one or more .java files under your &ldquo;src&rdquo; subfolder of your existing project folder and then include it in your project.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2388.slnexplorer.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2388.slnexplorer.png\" alt=\"Image 2388 slnexplorer\" width=\"341\" height=\"285\" class=\"aligncenter size-full wp-image-29606\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2388.slnexplorer.png 341w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2388.slnexplorer-300x251.png 300w\" sizes=\"(max-width: 341px) 100vw, 341px\" \/><\/a><\/p>\n<h2>Editing Java sources (New in Update 1, Experimental)&nbsp;<\/h2>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/5516.editor-breadcrumb.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/5516.editor-breadcrumb.png\" alt=\"Image 5516 editor breadcrumb\" width=\"698\" height=\"180\" class=\"aligncenter size-full wp-image-29613\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/5516.editor-breadcrumb.png 698w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/5516.editor-breadcrumb-300x77.png 300w\" sizes=\"(max-width: 698px) 100vw, 698px\" \/><\/a><\/p>\n<p>When first opening a .java file in the editor, you&rsquo;ll notice a new breadcrumb notification message that encourages you to install the <a href=\"https:\/\/visualstudiogallery.msdn.microsoft.com\/53e6e65b-fa0f-411a-a98d-7911009537ac\">new Visual Studio extension for Java language support<\/a>. This notification can be dismissed, but we recommend that you try out this extension and share with us your experience. <strong>Note:<\/strong> you need to restart Visual Studio after installing the extension for it to kick into action.<\/p>\n<p>The extension will provide <strong>colorization<\/strong> (both syntactic and semantic), <strong>error and warning squiggles<\/strong> as well as <strong>code outlining<\/strong> and <strong>semantic highlighting<\/strong> in your Java files.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/1067.editor-extension.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/1067.editor-extension.png\" alt=\"Image 1067 editor extension\" width=\"700\" height=\"375\" class=\"aligncenter size-full wp-image-29605\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/1067.editor-extension.png 700w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/1067.editor-extension-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>In addition to these, while writing code, you&rsquo;ll get IntelliSense help:<\/p>\n<ul>\n<li><strong>Member List<\/strong> will show the possible candidates for import statements, instance members, etc.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4431.editor-isense-2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4431.editor-isense-2.png\" alt=\"Image 4431 editor isense 2\" width=\"482\" height=\"259\" class=\"aligncenter size-full wp-image-29612\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4431.editor-isense-2.png 482w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4431.editor-isense-2-300x161.png 300w\" sizes=\"(max-width: 482px) 100vw, 482px\" \/><\/a><\/p>\n<ul>\n<li><strong>Parameter Help<\/strong>&nbsp;will aid with writing function calls&nbsp;<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/3527.editor-isense-paramhelp-2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/3527.editor-isense-paramhelp-2.png\" alt=\"Image 3527 editor isense paramhelp 2\" width=\"568\" height=\"129\" class=\"aligncenter size-full wp-image-29610\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/3527.editor-isense-paramhelp-2.png 568w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/3527.editor-isense-paramhelp-2-300x68.png 300w\" sizes=\"(max-width: 568px) 100vw, 568px\" \/><\/a><\/p>\n<ul>\n<li><strong>Quick Info<\/strong> will appear when hovering your mouse over any symbols<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/6433.editor-isense-quickinfo-2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/6433.editor-isense-quickinfo-2.png\" alt=\"Image 6433 editor isense quickinfo 2\" width=\"431\" height=\"125\" class=\"aligncenter size-full wp-image-29615\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/6433.editor-isense-quickinfo-2.png 431w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/6433.editor-isense-quickinfo-2-300x87.png 300w\" sizes=\"(max-width: 431px) 100vw, 431px\" \/><\/a><\/p>\n<p>Another handy feature for larger codebases or for navigating 3<sup>rd<\/sup> party libraries for which you have the source code available is <strong>Go to definition (F12)<\/strong> which will take you to the symbol definition location (if available).&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/5722.editor-gotodef.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/5722.editor-gotodef.png\" alt=\"Image 5722 editor gotodef\" width=\"563\" height=\"274\" class=\"aligncenter size-full wp-image-29614\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/5722.editor-gotodef.png 563w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/5722.editor-gotodef-300x146.png 300w\" sizes=\"(max-width: 563px) 100vw, 563px\" \/><\/a><\/p>\n<h2>Debugging Java sources (New in Update 1)<\/h2>\n<p>To turn on Java debugging for your Android projects in your next debugging session, in the Debug Target toolbar, change <strong>Debug Type dropdown<\/strong> to <strong>&ldquo;Java Only&rdquo;<\/strong> as in the picture below.&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/0728.debug-target.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/0728.debug-target.png\" alt=\"Image 0728 debug target\" width=\"477\" height=\"73\" class=\"aligncenter size-full wp-image-29604\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/0728.debug-target.png 477w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/0728.debug-target-300x46.png 300w\" sizes=\"(max-width: 477px) 100vw, 477px\" \/><\/a><\/p>\n<p>To make the choice persist, you can also go to a project&rsquo;s properties (right click in Solution Explorer and select &ldquo;Properties&rdquo;) and in the Debugging tab switch <strong>Debugger Type<\/strong> to <strong>&ldquo;Java Only&rdquo;<\/strong>.&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2626.debugger-java-on.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2626.debugger-java-on.png\" alt=\"Image 2626 debugger java on\" width=\"820\" height=\"281\" class=\"aligncenter size-full wp-image-29608\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2626.debugger-java-on.png 820w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2626.debugger-java-on-300x103.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2626.debugger-java-on-768x263.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>You can now set <strong>line breakpoints<\/strong> anywhere in your Java code. Not only that, but you can <strong><a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2014\/10\/06\/new-breakpoint-configuration-experience.aspx\">add conditions<\/a> or hit counts <\/strong>for the breakpoints to be hit as well as <strong>specify breakpoint actions<\/strong> you want to take when the breakpoints are hit, including continuing the execution of the program (i.e. turn the breakpoint into a <strong><a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/10\/10\/tracepoints.aspx\">TracePoint<\/a><\/strong>).<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2450.breakpoint-cond-action-cont.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2450.breakpoint-cond-action-cont.png\" alt=\"Image 2450 breakpoint cond action cont\" width=\"573\" height=\"324\" class=\"aligncenter size-full wp-image-29607\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2450.breakpoint-cond-action-cont.png 573w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2450.breakpoint-cond-action-cont-300x170.png 300w\" sizes=\"(max-width: 573px) 100vw, 573px\" \/><\/a><\/p>\n<p>When a breakpoint is hit, you have access to several debug windows providing you insights into the state of your application: <strong><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/a3694ts5.aspx\">Call stack<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/esta7c62.aspx\">Watch and Locals windows<\/a>, and Logcat<\/strong>.&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4401.debug-windows.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4401.debug-windows.png\" alt=\"Image 4401 debug windows\" width=\"836\" height=\"691\" class=\"aligncenter size-full wp-image-29611\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4401.debug-windows.png 836w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4401.debug-windows-300x248.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/4401.debug-windows-768x635.png 768w\" sizes=\"(max-width: 836px) 100vw, 836px\" \/><\/a><\/p>\n<p><strong>Threads window<\/strong> aids with multi-threaded debugging by displaying the full list of threads including their names and respective call-stacks.&nbsp;<\/p>\n<p>In the <strong>Exceptions window,<\/strong> you can configure which first chance exceptions you&rsquo;d like the debugger to stop on. Once an exception is thrown, execution will stop to the specific location in code with a familiar <strong>First Chance Exception dialog<\/strong> giving you the opportunity to inspect the exception.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2703.exception-dialog.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2703.exception-dialog.png\" alt=\"Image 2703 exception dialog\" width=\"543\" height=\"306\" class=\"aligncenter size-full wp-image-29609\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2703.exception-dialog.png 543w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/2703.exception-dialog-300x169.png 300w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><\/a><\/p>\n<p>In addition to the watch window, you can also use the convenient <strong>DataTips<\/strong> to quickly view the value of a variable or <strong>pin DataTips<\/strong> for specific variables right inside the editor.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/8507.datatips.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/8507.datatips.png\" alt=\"Image 8507 datatips\" width=\"1117\" height=\"330\" class=\"aligncenter size-full wp-image-29616\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/8507.datatips.png 1117w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/8507.datatips-300x89.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/8507.datatips-1024x303.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2015\/11\/8507.datatips-768x227.png 768w\" sizes=\"(max-width: 1117px) 100vw, 1117px\" \/><\/a><\/p>\n<p>This summarizes the current support for Java debugging and language services in Android projects for Visual Studio 2015 Update 1. We look forward to you trying out these new features and sharing your feedback either through <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt280277.aspx\">Send-A-Smile\/Frown<\/a> (use #cpp2015), <a href=\"http:\/\/connect.microsoft.com\/VisualStudio\">Connect<\/a>, <a href=\"http:\/\/visualstudio.uservoice.com\/\">User Voice<\/a> or down below in the comments.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As part of our continued efforts to make Visual Studio a productive environment for developing mobile applications we&rsquo;re pleased to announce that Visual Studio 2015 Update 1 RC adds support for debugging your Java source files that are part of your Android projects and (with the help of an extension) get IntelliSense and Browsing assistance [&hellip;]<\/p>\n","protected":false},"author":308,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[232,140,233,55,6,14,244],"class_list":["post-7211","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","tag-android","tag-c","tag-cross-platform","tag-debugging","tag-ide","tag-intellisense","tag-java"],"acf":[],"blog_post_summary":"<p>As part of our continued efforts to make Visual Studio a productive environment for developing mobile applications we&rsquo;re pleased to announce that Visual Studio 2015 Update 1 RC adds support for debugging your Java source files that are part of your Android projects and (with the help of an extension) get IntelliSense and Browsing assistance [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/7211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/308"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=7211"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/7211\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=7211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=7211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=7211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}