In its recent update to Android Studio Ladybug (2024.2.2), Google has added new Gemini Code Transforms to modify, refactor, or create code, debugging and testing tools, and developer experience improvements. Additionally, the IDE adopts the latest IntelliJ 2024.2 platform release.
Gemini Code Transforms allow developers to simplify complex code, perform specific code transformations, generate new functions, and add documentation to existing code. The new feature includes a prompt where you describe the change you want to make, for example: “simplify and make idiomatic” some selected code, “add documentation”, and so on. Once Gemini has provided a suggestion based on your prompt, you can further refine it using a new prompt before accepting the change.
You can also rename a variable, a class, or method using the “Refactor > Rename” action. Gemini will suggest a number of candidates based on the context ot the selected name. A related transform is “Rethink variable names” which will analyze an entire file and suggest a list of changes to variable and method names to improve readability and maintainability.
Furthermore, you can use one of the “Gemini > Document *” actions to add documentation for functions, classes, or properties. In this case, too, before accepting the change you have the possibility to modify the suggestion or ask Gemini to further refine it using a prompt. Finally, you can generate a detailed commit message for all the changes you made to your code.
Android Studio Ladybug 2024.2.2 also includes new debugging tools for Wear OS, allowing you to preview a Wear OS tile animation in real time. In the preview, you can control the animation playback speed and inspect or modify variables to see how they alter the animation. Any change you make to the code defining the animation is immediately reflected in the preview pane.
Additionally, Ladybug 2024.2.2 makes it easier to work with health data using the new Wear Health Services. This allows you to simulate activity, including hart rate, distance and speed, directly in the emulator. Prior to this, you needed to use a physical device and possibly leave your desk to carry through some physical activity to generate new health data.
Other new features in Ladybug 2024.2.2 are meant to improve developer experience, such as the App Links Assistant, aimed to simplify the implementation of App Links by serving JSON data that resolves broken links, and Google Play SDK Insights, which is an enhanced linter for public SDKs from the Google Play SDK Index and the Play Developer Console.
As a final note, Android Studio Ladybug 2024.2.2 includes IntelliJ 2024.2, which brings more intuitive code completion suggestions, adds preview in the Search Everywhere dialog, and improves log management.