paint-brush
Stunning New Features of Android Studio 3.0by@geekyants
8,833 reads
8,833 reads

Stunning New Features of Android Studio 3.0

by GeekyAntsJanuary 31st, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Android Studio 3.0 has released, and most Android developers seem happy about it. There are so many new features and improvements that updating your IDE to this new version is clearly a new brainer!

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Stunning New Features of Android Studio 3.0
GeekyAnts HackerNoon profile picture

Android Studio now comes with Instant App Support, Android Profiler, ContraintLayout, Support for Kotlin and much more!

Android Studio 3.0 has released, and most Android developers seem happy about it. There are so many new features and improvements that updating your IDE to this new version is clearly a new brainer!

How to update

Updating the IDE and Plugin

Android Studio should have prompted you to update to 3.0. If it hasn’t done so, then go to ‘Check for updates’ in the menu bar to do so.

Once you launch your project in 3.0 for the first time, Android Studio will tell you that there is a new version of the plugin to update to. You can continue to use your project as it is, but you will miss out on many of the new features and improvements until you update. Simply, follow the prompts to have your project updated to version 3 of the Gradle plugin and to use the latest version of Gradle 4.

Why should I update?

There is an endless list of new features and improvements in Android Studio 3.0 and in the new Gradle plugin.

Though this list is long, it still doesn’t cover all the features of Android Studio 3.0! If you are interested, you can check out the full release notes on the Android developers website.

In this post, I will only be focusing on a select few features of Android Studio 3.0:

  • Instant App Support
  • Android Profiler
  • Constraint Layout
  • Kotlin Programming Language Support

I will also write about Kotlin and how it is different from TypeScript.

Instant App Support

Android Studio 3.0 now lets you build Instant Apps. Android Instant Apps enable native Android applications to run on your device by launching a URL. Simply put, you can run an app on your device, without having to install it!

With Instant Apps, users can use a single feature of an app without having to install the app with all its other features. When users request a feature from an instant app, they receive only the code necessary to run that specific feature, no more and no less. After the users have finished using the feature, the system can dispose of the features’ code.

To provide this on-demand downloading of features, you need to break up your app into smaller modules and refactor them into feature modules.

When you build an instant app project, the build outputs are Instant App APKs that contain one or more feature APKs. Each feature APK is built from a feature module in your project and can be downloaded on demand by the user and launched as an instant app.

New York Times Crossword

The New York Times created a simple, but highly effective user experience: once you click their URL, you are immediately able to play the daily mini crossword puzzle. If you then want to continue playing puzzles, you can play one of the other free puzzles, wait for tomorrow’s daily puzzle, or subscribe using Play in-App Billing to access even more puzzles.

This Instant App has been used more frequently and those using the instant app have more than doubled the number of sessions. The more time someone spends in the app, the more likely they are to subscribe and remain a user, so this is an important metric for the team!

Check out more Instant Apps here:


Apps to Try Now - Android Apps on Google Play_Enjoy millions of the latest Android apps, games, music, movies, TV, books, magazines & more. Anytime, anywhere, across…_play.google.com

Android Profiler

The new Android Profiler window in Android Studio 3.0 replaces the Android Monitor tools. This new tool provides real-time data for your app’s CPU, memory, and network activity.

You can perform sample-based method tracing to time your code execution, capture heap dumps, view memory allocations, and inspect the details of network-transmitted files.

ConstraintLayout

ConstraintLayout allows you to create large and complex layouts with a flat view hierarchy (no nested view groups). Just like [RelativeLayout](https://developer.android.com/reference/android/widget/RelativeLayout.html), all views are arranged according to relationships between sibling views and the parent layout. The only difference is that ConstraintLayout is more flexible than RelativeLayout and easier to use with Android Studio’s Layout Editor.

To learn more about ConstrainLayout, click here:


Build a Responsive UI with ConstraintLayout | Android Developers_ConstraintLayout is available in an API library that's compatible with Android 2.3 (API level 9) and higher. This page…_developer.android.com

Support for Kotlin

Kotlin is a statically-typed programming language by JetBrains that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure.

Android Studio 3.0 lets you code in Kotlin! In fact, Google has even deemed it as the First Class Citizen for writing Android Apps!

The reason for such a major decision was that Kotlin code proved to have:

  • Better readability — Readable code is one that clearly communicates its intention to the reader. The perfectly readable code is one that even a non-coder can understand perfectly!
  • Better correctness — Correctness from a developer’s perspective is defined as the adherence to the specifications that determines how users can interact with the code and how the code should behave when it is used correctly.
  • Developer Productivity — This is a measure of the capability of a developer to coordinate with the team and implement a better code. Time management is also an important factor in developer productivity.

As I said before, Kotlin is a statically typed programming language. A language is said to be statically typed if the type of a variable is known at compile time.

For some languages, this would mean that a programmer needs to specify the type of a variable before using it in the code.

Kotlin uses an aggressive type inference to determine the type of values and expressions for which type has not been stated.

Kotlin vs TypeScript

TypeScript was created to provide type safety to JavaScript. Kotlin also helps you achieve this goal, and in addition, Kotlin provides the best of JVM and the web.

TypeScript is a superset of JavaScript. So basically, it is JavaScript. This makes it easier for JavaScript developers to shift to TypeScript.

Kotlin, on the other hand, is a completely different language that runs on the Java Virtual Machine (JVM). And though Kotlin can be compiled to JavaScript, the question one has to ask is to why should a developer go through the hassle of learning a completely different language which can be compiled down to JavaScript, when we have TypeScript: which is JavaScript but with the added type safety.

But while TypeScript aims to replace JavaScript, Kotlin has much bigger plans of becoming full-stack for creating apps!

Also, Kotlin has features like built-in null safety that gives it an edge over TypeScript.

If the above arguments have confused you even more and now you don’t know whether to use Kotlin or TypeScript, here is a comparison between the syntax of the two languages based on several fronts:

Variables and Constraints




// Kotlinvar myVariable = 42myVariable = 50val myConstant = 42




// TypeScriptvar myVariable = 42;myVariable = 50;val myConstant = 42;

Explicit Types


// Kotlinval explicitDouble: Double = 70.0


// TypeScriptconst explicitDouble: number = 70;

Type Coercion




// Kotlinval label = 'The width is "val width = 94val widthLabel = label + width




// TypeScriptconst label = "The width is ";const width = 94;const widthLabel = label + width;

String Interpolation




// Kotlinval apples = 3val oranges = 5val fruitSummary = "I have ${apples + oranges} " + "pieces of fruit"




// TypeScriptconst apples = 3;const oranges = 5;const fruitSummary = `I have ${apples + oranges} ` + "pieces of fruit.";

When to Kotlin and when to TypeScript?

  • You can use Kotlin to develop your back-end, front-end, Android app, and desktop app. You can also share/re-use data classes, models, validation, etc. and can also be used with Java as Kotlin is compatible with it.
  • TypeScript is perfect if you working on the front-end. KotlinJS is not as mature as TypeScript and does not yet have the same kind of community support that TypeScript enjoys. Having said that, if you are looking to build an enterprise-grade back-end, front-end, and a Native Android App, go with Kotlin.
  • There is one major flaw in TypeScript — It is a superset of JavaScript. This means that, apart from the issue type safety, everything that is wrong with JavaScript will still be there to pester you. Though KotlinJS has the term “JS” in it, it has actually outright eliminated a whole bunch of these issues.

I am Rajat S, a Technical Content Writer at GeekyAnts. An aspiring coder who has a long way to go. A Die-Hard DC Comics Fan who loves Marvel Movies. 😛 Follow me on Twitter to know more about all the amazing things that are happening at GeekyAnts.

Thanks to Rahul Raj, who is a Software Engineer at GeekyAnts.

And thank you for reading! Please do 👏 if you liked it.