Android Studio 3.0 seems to be living up to that major version change the 3.0 number implies. There are many useful new tools for developers, especially when it comes to improving and easing the burden of debugging. There are also some changes that will require advanced preparation to keep your apps and workflow functioning before things break. We have many things to cover, so let's dive in.
To start, 3.0 brings with it support for Kotlin, which we also covered here, so you don't need to install anything extra to be able to play around with the new language support. All the interested need to do is jump forward into 3.0 via the Canary channel and enable it, either in their next app via the new project wizard, or via the language selector when adding new activities to an existing project. There is also a conversion tool for bringing your Java classes over to Kotlin. It's not going to be magic, but it should help with porting stuff over.
In other language-related news for the platform, we also get the new desugar bytecode transformations from javac in the default toolchain. This can replace the now deprecated Jack and Retrolambda for bringing some convenient Java 8 features into Android Studio like lambdas, method references, default and static interface methods, and try-with-resources.
New targets and platforms
The new Android Instant Apps SDK, recently opened for all to use, also requires Android Studio 3.0. So even if you aren't interested in Kotlin, you'll have to jump into the canary channel if you are looking forward to playing with that. IntelliJ IDEA is still the base for Android Studio, and the change to 3.0 updates things to the 2017.1 branch. That means you get all the same new features from that version like semantic highlighting, Java 8 refactoring, enhanced version control search, and smart conflict resolution. New layout and graphical resource tools are also present in the form of adaptive icon support and expanded font support to include making and previewing XML and binary fonts, as well as the ability to download from Google Fonts in the Layout Editor.
Android Things support is now also present in the IDE via a convenient new set of templates in associated wizards, so the barrier to entry for development on that platform is going to be much lower.
Design and build
The new Android Studio brings with it a new Gradle plugin that is all about speeding up your build process and increasing the granularity of dependencies. This has also resulted in changes in the DSL for Gradle that broke the old API in Android Studio. If you depended on them, you might have to check and see what effect that has on you and, if necessary, migrate things over at some point. Google is also now self-distributing its build artifacts in its aptly named Google's Maven Repo, so setting up continuous integration servers for your projects will be a bit easier.
Both the Layout Editor and Layout Inspector are seeing changes in 3.0, to better help with improving your app UI and overall user experience. There are new constraints like chains, barriers, and groups for easing chain creation and making sure things look the way you want on more devices and in more situations. There is also a new error panel for layout issues to let you know if you might be missing any constraints that could otherwise mess with your UI.
Debugging seems to have been given a big focus with the updated tools in Android Studio 3.0. For one, the new Android Profiler. As we mentioned in the previous post, it gives developers a means of visually identifying CPU, Memory, and Network usage spikes that might correspond to app events, which are also labeled on the graph. For non-O based emulator images or devices, you have to enable advanced profiling in the run configuration window to see all the new features. The resolution also increases at a fine level for finding the precise cause of jank on all of the three graphs. For CPU usage that means you can view things down to checking thread usage and method traces. With the RAM use graph, you get more precise memory allocation, the ability to track object allocations, and you can dive into heap dumps. Network info gives you requests and responses for headers and payloads done in HTTP or via supported clients like Volley and OkHttp.
The Android Studio native debugger also now works for APKs made in game toolkits like like Unity, APKs with C/C++ code, and APKs from other IDEs. The APK analyzer in Android Studio has been updated to work with Instant App zips. The text viewer also has an updated UI with more filter and search options, and can also now open shrunk and obfuscated code via ProGuard mapping files as well as create ProGuard keep rules.
There are also smaller features in the update that will improve the overall quality of life for developers. The Device File Explorer is, as you'd guess, a new way to explore file systems on emulators or connected devices in the IDE, so you don't have to use ADB for that. The emulator will also have full OpenGL ES 3.0 support, WiFi network emulation, a bug reporter, and images will include the full Play Store. The latter will cut down prep time before testing and will make updating Play Services or other apps required easier. The new images are signed, though, so you won't be able to get root in them. Android Wear developers will also be able to use rotary input controls in their apps, at least on devices that have crowns that feature rotational input.
There are a lot of SDK updates you'll need to use the new tools, and I'll toss those in a note below so you can double check that you are up to date if you run into any issues.
Canary and Dev Channel Updates
- SDK Platform O r2*
- Build-tools 26.0.0-rc2
- Platform-Tools 26.0.0-rc2
- Emulator 26.1.0
- Android O Google API's x86 System Images r3
- Android TV x86 O System Image r2
- Android O Play x86 Play System Images r3
- O Wear System Image r2
- NDK r15 beta 2
- Android Instant Apps 1.0
- Google Repository Updates
Stable Channel Updates
- Platform-tools 25.0.6
The new O Developer Preview image is also available for download. You can, therefore, use these new features in Android Studio 3.0 on the newest version of Android in the emulator. Between the Canary channel and Developer Beta, I would expect bugs to multiply on bugs, but you can thankfully have both the old stable and new canary versions installed alongside one another. Either way, some of the new changes with things like Gradle will require that you update your stuff at some point. It might be worth backing things up and updating your Gradle plugin just to test if anything breaks.