Studio Bot - Let AI write Android code for me

Google I/O 2023


Unsurprisingly, this year's I/O conference only highlighted one keyword "AI" . Google's various products have become a stage for it to demonstrate the strength of AI. Even Android Studio, a developer-oriented product, has added new Studio botfeatures , hoping to help developers write code more easily through AI:

ezgif.com-video-to-gif.gif

Studio Bot uses Google's coding base model Codey(the latter is based on the latest PaLM2 large language model) to help developers generate program code and improve productivity. We can also ask the Studio Bot about Android development, or help fix bugs in the current code. Studio Bot is in its early stages and is currently only available in the US region, but supports Chinese communication! Interested friends can experience it over the wall.

Anyone who involves code will naturally make people worry about security issues. Google attaches great importance to privacy and security. The content of our chat with Studio Bot will not be used for other purposes, so you can use it with confidence.

How to start Studio Bot


1. Update Android Studio

Update to the latest version of Android Studio Hedgehog.

2. Open the function view

View > Tool Windows > Studio Bot

3. Login account

Log in with your Google account and click Next to start the conversation

What can Studio Bots do?


1. Generate code

This is a very useful function, we can let Studio Bot help us generate the required code. And compared to relying on the various uneven information obtained by searching, the answers given by Studio Bot are more readable and more reliable through its powerful generative AI capabilities. For example, I need a piece of code to create a Room database, and I get the following answer:

Moreover, Studio Bot can remember the context of the conversation, you can add related questions, and it can understand your intentions by itself. For example, I hope to change the code I just generated to Kotlin, as follows:

代码变成了 Kotlin 版本,还配了详细的说明

2. 回答问题

回答各种技术问题,比如关于 Android Studio 使用技巧,甚至任何通用的 Android 开发知识。

3. 解读代码

这个功能相当炸裂,你可以选中 IDE 中的任意代码片段,去 Ask Studio Bot 获取代码的解读。

image.png

以下是解读的结果,将每一行代码翻译成更能听懂的“人话”。 Studio Bot 是支持中文的,中文回答的效果看起来也不错,对技术词语的翻译很到位,一点不晦涩。

image.png

对于很多一眼看不懂的花哨代码,将会非常有用,是大家学习开源项目的利器!

一些常见问题


1. Studio Bot 会将我的代码发送到 Google 服务器吗?

发送给 Studio Bot 的代码需要上传服务器才能获得回答,但是这些代码不会被滥用,如果你担心代码安全可以不提问关于你的代码的问题,IDE 的私有代码绝不会被私自上传服务器

2. 代码会用来训练 Studio Bot 模型吗

Ask Studio Bot 这样的功能不会将你的代码送去训练模型,只是用来获取问题答案

3. Studio Bot 的回答是准确无误的吗?

Studio Bot 目前还是实验性产品,无法保证答案的绝对正确。Bot 在回答后会跟有 “赞” 和 “踩”,通过这些反馈将帮助模型更好地成长,准确度会越来越高。

4. Studio Bot 可以提供关于代码的帮助吗?

当然,如前面介绍的,它可以生成代码,也可以基于你的代码提供一些解读,它主要的场景就是服务写代码这件事情

5. Studio Bot 在回答中如何引用来源?

Studio Bot 应该更多地生成原创内容,而不是复制已有内容。万一 Studio Bot 引用了大篇幅源码,那么它会标记引用来源,引用源可能涉及开源许可证,所以参考回答时也需要遵守许可证的要求。

6. 如何对 Studio Bot 进行反馈?

前面提到了,可以得到回答后,即时给出“赞”或者“踩”的反馈,帮助其成长,服务他人也更好地服务自己。

7. Can I ask Studio Bot any questions?

Studio Bot was born to answer all kinds of Android development questions, and it may not be able to answer questions in other fields well.

8. How is it different from other large language model robots (such as ChatGPT, GoogleBard, etc.)?

Studio Bot is designed for Android Studio, can be well integrated with IDE, and provides many coding-oriented functions for out-of-the-box machines, which are not available in general chat bots.

9. Give some usage suggestions?

The question should be as concise and clear as possible. If the Bot does not understand your question, you can reorganize the sentence. In addition, you need to judge the answer. After all, this kind of generative answer cannot be guaranteed to be absolutely correct.

developer.android.com/studio/prev…

Guess you like

Origin juejin.im/post/7231997803559141413