Android Studio 3.0: Kotlin support, new Android plugin for Gradle and more
© Shutterstock / kirill_makarov
We’ve been talking about Kotlin’s first-class status for the past five months — and now that Android Studio 3.0 is here, it’s possible to add Kotlin to your project. This is not the only highlight of the latest Android Studio release —support for Java 8 language features has been improved, there’s an Android Plugin for Gradle 3.0.0 and the list goes on.
Android Studio 3.0 is here
If Android Studio 3.0 sounds familiar, that’s because it was announced at Google I/O 2017 earlier this year. This release focuses on accelerating your app development on Android, according to Jamal Eason, Product Manager at Google.
Although the list of new updates is pretty long, there are three major feature areas that you don’t want to miss, Eason wrote in a blog post announcing Android Studio 3.0.
- a new suite of app profiling tools to quickly diagnose performance issues,
- support for the Kotlin programming language,
- a new set of tools and wizards to accelerate your development on the latest Android Oreo APIs.
Before we dive deeper into the list of new features, you should probably have a look at this video:
You can download Android Studio 3.0 here.
Support for Kotlin ✓
Eason revealed that beloved features such as code completion and syntax highlighting work well in Android Studio 3.0 and explained that the team will continue to improve the rest of the editor features in the next release.
If you want to add Kotlin to your project, you can either use the built-in conversion tool found under Code → Convert Java File to Kotlin File or create a Kotlin enabled project with the New Project Wizard.
If you’re still wondering why the Android team chose Kotlin, you should read this blog post by Mike Cleron, Director of the Android Platform.
Kotlin plays well with the Java programming language, Cleron explained. “The effortless interoperation between the two languages has been a large part of Kotlin’s appeal.” Furthermore, this programming language will be “very familiar to anyone who has used the Java programming language.”
Cleron also revealed that developers love Kotlin and we couldn’t agree more. According to the results of our annual survey, Kotlin occupies the sixth position. However, since the first two positions are occupied by Java 9 and Java 6, 7 and 8 respectively, one could say that this young programming language is technically in top 5 most beloved (and used) programming languages.
Java 8 language features support
Users can now use some Java 8 language features and consume libraries built with Java 8. Since Jack is no longer required, you need to disable it to use the improved Java 8 support built into the default toolchain.
This is what you have to do in order to update your project to support the new Java 8 language toolchain:
- update your Source and Target compatibility levels to 1.8 in the Project Structure dialog(click File > Project Structure). Read this if you want to learn how to use Java 8 language features.
Android Plugin for Gradle 3.0.0
The new Android plugin for Gradle brings a multitude of improvements and new features. However, the most impressive highlight is the fact that it improves build performance for projects with a large number of modules.
When using the new plugin with large projects, you’ll notice the following changes:
- Faster build configuration times due to new delayed dependency resolution.
- Variant-aware dependency resolution for only the projects and variants you are building.
- Faster incremental build times when applying simple changes to code or resources.
If you’re ready to upgrade to the new plugin, see Migrate to Android Plugin for Gradle 3.0.0.
The Android team has completely rewritten the previous set of Android Monitor tools and replaced them with the Android Profiler.
This is what you have to do: once you deploy your app to a running device or emulator, click on the Android Profiler tab — you now have access to a real-time & unified view of the CPU, Memory, & Network activity for your app. You should know that each performance event is mapped to the UI event timeline which highlights touch events, key presses, and activity changes in order to give you more context on when and why a certain event happened.