{"id":3133,"date":"2023-03-30T11:41:53","date_gmt":"2023-03-30T18:41:53","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/surface-duo\/?p=3133"},"modified":"2024-01-03T16:26:54","modified_gmt":"2024-01-04T00:26:54","slug":"android-openai-chatgpt-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/surface-duo\/android-openai-chatgpt-1\/","title":{"rendered":"OpenAI Android developer assistance"},"content":{"rendered":"<p>\n  Hello budding prompt engineers,\n<\/p>\n<p>\n  Many developers are already getting assistance from <a href=\"https:\/\/github.com\/features\/copilot\/\">GitHub Copilot<\/a> completing code and more recently the <a href=\"https:\/\/github.blog\/2023-03-22-github-copilot-x-the-ai-powered-developer-experience\/\">conversational additions<\/a> to GitHub pull requests, documentation, and the CLI. In this post we\u2019ll look at some of the ways that Android developers can take advantage of OpenAI- and ChatGPT-powered tools.\n<\/p>\n<h2>GitHub Copilot in Android Studio<\/h2>\n<p><a href=\"https:\/\/docs.github.com\/en\/copilot\/configuring-github-copilot\/configuring-github-copilot-in-your-environment\">GitHub Copilot can be added to Android Studio<\/a> as a plugin \u2013 from the <strong>Settings\/Preferences<\/strong> screen go to <strong>Plugins<\/strong>, search for \u201ccopilot\u201d and choose <strong>Install<\/strong>:\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"703\" height=\"527\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-1.png\" class=\"wp-image-3134\" alt=\"Android Studio plugin marketplace screen showing GitHub Copilot\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-1.png 703w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-1-300x225.png 300w\" sizes=\"(max-width: 703px) 100vw, 703px\" \/><br\/><em>Figure 1: GitHub Copilot in the Plugin Marketplace<\/em>\n<\/p>\n<p>\n  Once installed (and Android Studio restarted) there will be a <strong>GitHub Copilot<\/strong> tool window to show suggestions as well as autocompletions as you type (if enabled):\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"1470\" height=\"886\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/android-studio-showing-source-editor-project-with.png\" class=\"wp-image-3135\" alt=\"Android Studio showing Source Editor project with GitHub Copilot tool window with suggestions\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/android-studio-showing-source-editor-project-with.png 1470w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/android-studio-showing-source-editor-project-with-300x181.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/android-studio-showing-source-editor-project-with-1024x617.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/android-studio-showing-source-editor-project-with-768x463.png 768w\" sizes=\"(max-width: 1470px) 100vw, 1470px\" \/><br\/><em>Figure 2: GitHub Copilot suggestions in Android Studio<\/em>\n<\/p>\n<p>\n  In Figure 2 copilot is suggesting Jetpack Window Manager boilerplate in our <a href=\"https:\/\/github.com\/microsoft\/surface-duo-window-manager-samples\/tree\/main\/SourceEditor\">SourceEditor<\/a> sample. In addition to the solutions tool window, you can trigger inline suggestions with <kbd>Alt+\\<\/kbd> and toggle between suggestions with <kbd>Alt+[<\/kbd> and <kbd>Alt+]<\/kbd> (on macOS use the <kbd>Option \u2325<\/kbd> key).\n<\/p>\n<p>\n  Installing the plugin will also add a settings screen under <strong>Languages &amp; Frameworks<\/strong> where you can enable or disable completions globally or for specific programming languages.\n<\/p>\n<h2>Code Q&amp;A<\/h2>\n<p>\n  Outside of the IDE, <a href=\"https:\/\/chat.openai.com\/\">ChatGPT<\/a> can also answer coding questions and much more, directly in the browser. For example, in Figure 3 the prompt asks about the \u201cparameterized strings\u201d feature, and ChatGPT answers with both an explanation and code examples:\n<\/p>\n<p>\n  <img decoding=\"async\" width=\"1083\" height=\"1383\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/graphical-user-interface-application-description.png\" class=\"wp-image-3136\" alt=\"ChatGPT conversation screenshot answering a prompt about coding in Kotlin\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/graphical-user-interface-application-description.png 1083w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/graphical-user-interface-application-description-235x300.png 235w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/graphical-user-interface-application-description-802x1024.png 802w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/graphical-user-interface-application-description-768x981.png 768w\" sizes=\"(max-width: 1083px) 100vw, 1083px\" \/><br\/><em>Figure 3: ChatGPT answering a coding question<\/em>\n<\/p>\n<p>\n  For more prompt ideas, this <a href=\"https:\/\/www.droidcon.com\/2023\/03\/13\/chatgpt-for-android-developers\/\">ChatGPT post<\/a> has some great examples of generating Kotlin code, finding bugs, writing tests, writing documentation, and explaining concepts.\n<\/p>\n<h2>Help with localization<\/h2>\n<p>\n  Machine translation is never perfect and it\u2019s always preferable to have bilingual speakers review localization of your apps. However, <em>testing <\/em>your app in other languages for layout correctness, and making sure you haven\u2019t missed any strings, can be useful \u2013 even with imperfect translations. This is another area where ChatGPT can simplify a previously tedious process \u2013 because it can understand XML (and other) file formats and what should be translated versus preserved,   \n<\/p>\n<p>\n  <img decoding=\"async\" width=\"842\" height=\"523\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-4.png\" class=\"wp-image-3137\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-4.png 842w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-4-300x186.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-4-768x477.png 768w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/>\n<br\/>\n  <img decoding=\"async\" width=\"838\" height=\"347\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-5.png\" class=\"wp-image-3138\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-5.png 838w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-5-300x124.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2023\/03\/word-image-3133-5-768x318.png 768w\" sizes=\"(max-width: 838px) 100vw, 838px\" \/>\n<\/p>\n<p>\n  The resulting XML can then be included in appropriately named <strong>values-fr\/strings.xml<\/strong> and <strong>values-de\/strings.xml<\/strong> (French and German) resource files. This example is from our <a href=\"https:\/\/github.com\/microsoft\/surface-duo-window-manager-samples\/tree\/main\/SourceEditor\">SourceEditor<\/a> sample app.\n<\/p>\n<p>\n  As with any machine processed output, you should verify everything before using it in a public release.\n<\/p>\n<h2>Resources and feedback<\/h2>\n<p>\n  You can sign up for OpenAI at <a href=\"https:\/\/openai.com\/\">https:\/\/openai.com\/<\/a> to start querying all your code questions.\n<\/p>\n<p><a href=\"https:\/\/github.com\/features\/preview\/copilot-x\">GitHub Copilot X<\/a> has a preview sign-up form to test the pull-request improvements and other new features.\n<\/p>\n<p>\n  If you have any questions about applying AI to your development tools, use the <a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\">feedback forum<\/a> or message us on Twitter <a href=\"https:\/\/twitter.com\/surfaceduodev\">@surfaceduodev<\/a>.\n<\/p>\n<p>\n  We won\u2019t be livestreaming this week, but check out the <a href=\"https:\/\/youtube.com\/c\/surfaceduodev\">archives on YouTube<\/a> and we\u2019ll see you online again soon!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello budding prompt engineers, Many developers are already getting assistance from GitHub Copilot completing code and more recently the conversational additions to GitHub pull requests, documentation, and the CLI. In this post we\u2019ll look at some of the ways that Android developers can take advantage of OpenAI- and ChatGPT-powered tools. GitHub Copilot in Android Studio [&hellip;]<\/p>\n","protected":false},"author":570,"featured_media":3136,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[741],"tags":[734,729,733],"class_list":["post-3133","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","tag-chatgpt","tag-machine-learning","tag-openai"],"acf":[],"blog_post_summary":"<p>Hello budding prompt engineers, Many developers are already getting assistance from GitHub Copilot completing code and more recently the conversational additions to GitHub pull requests, documentation, and the CLI. In this post we\u2019ll look at some of the ways that Android developers can take advantage of OpenAI- and ChatGPT-powered tools. GitHub Copilot in Android Studio [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/3133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/users\/570"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/comments?post=3133"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/3133\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media\/3136"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media?parent=3133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/categories?post=3133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/tags?post=3133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}