Studio Bot: An AI for Android Studio

Apiumhub - Jun 21 '23 - - Dev Community

Introduction

Every year, Google holds its Google I/O event, an annual developer conference, where the company unveils and showcases its latest developments, technologies, and products. This year, Android Studio’s artificial intelligence add-on was presented to compete with other tools such as Github Copilot. The new version of Android Studio (codenamed Hedgehog and still in the testing canary channel) is available to help write code and solve problems or more general development issues. This wizard is built on Codey, the new PaLM 2 model that is specifically trained for development.

How to access the bot

To start, we need to download the latest version of Android Studio Hedgehog. Google recommends that we agree to send our Android Studio data to improve Studio Bot, but that step is really not necessary.

Once we open Android Studio and a project, we have to go to View > Tool Windows > Studio Bot

If we have not done it before, we log in with our Google account, and the chat window will appear so that we can start chatting with the bot. It is important to note that right now you can only access it from the USA.

How to use it

Now that we have it enabled, we can start asking the bot all kinds of questions from generic to very specific. For example:

  • How can I add a Room database to my project?
  • How can I add the Dark Theme to my project?
  • How can I add permissions to a project, either camera, GPS…?
  • Can I pass Java code to convert it to Kotlin?
  • Can I pass XML views to Compose?
  • Ask the bot about specific Android Studio tools

All these questions and the ones you ask are a conversation, so Studio Bot will remember the context in which you are, in case you ask questions in a row about the same topic.

Keep in mind that the more specific the question is, the better the bot’s answer will be, and getting used to using it can take some time to get the most out of it.

Android Project CTA

How it can help you in your daily life

Studio bot offers a number of aids that can be integrated into your development workflow.

  • Add the generated code with a click. Studio Bot displays actions subsequent to the code it causes in your response. It allows you to add it quickly, insert it into the manifest, or even add library dependencies used in your response.
  • Quick access to documentation. Studio Bot offers to open the necessary documentation about your response to get deeper into the response.
  • Ask Studio Bot. If you select text from your project by right-clicking and selecting Ask Studio, Bot automatically populates the chat conversation with the selected text. You then decide whether or not you want to send it; Studio Bot does not send code without your express permission. Also, Ask Studio Bot can help you with Android Studio warnings and errors.
  • Generate unit tests. With a single click, you can generate unit tests of your code and the answers the chat gives you, saving a lot of time in setting up basic tests on your code.
  • Suggest names for your classes, variables, or methods. When naming a particular concept, you can ask the bot for synonyms or more appropriate words. Sometimes we use the first option that comes to mind, but having a range of options is always a great resource.

Experimental state: it can help you but be careful

Studio Bot is in experimental status, and although it can be beneficial, its answers may not be correct, so you should always double-check before using them. As its use spreads, it will improve little by little.

In the current state, you are responsible for using its answers as a source of truth. Google asks us to use them with care and test what we use against errors and vulnerabilities before trusting unthinkingly.

One of the doubts we may have about Studio Bot is whether it uses our code. The functionality of Ask Studio Bot sends the code you explicitly send but is not used to train the bot. If we accept to send the usage statistics in Android Studio, the feedback we give to the bot can be used to refine the learning models, such as the thumbs up and down of its responses. Google specifies that these statistics do not contain code from your project.

If you liked this article and you are interested in reading more about other artificial intelligence tools, you can visit Apiumhub’s blog. There you will find content related to Android development, iOS development, software architecture, and much more.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player