Android Pie API with more Kotlin-Friendly
At Google’s I/O Developers Conference 2017, Google announced Kotlin will be an officially supported language for Android app development. (For those unaware, Kotlin is an object-oriented language like Java. Java is currently the primary programming language for Android app development.) A few days after this announcement, Kotlin was listed among the of top programming languages that will define 2018. Then on, the language witnessed a mass adoption and Kotlin developers experienced an exponential rise in demand.
Google’s support for Kotlin
Google has extended its support to Kotlin by making Android 9.0 Pie Software Development Kit (SDK) more Kotlin-friendly. Google announced in its new blog post that the new Android pie SDK contains nullability annotations for some frequently used APIs. In general, the nullability violations in Kotlin end up with compilation errors. To avoid this, the internal mechanism marks the APIs as recently annotated.
Recently annotated APIs will give warnings rather than errors. This will preserve the null-safety guarantee when the Kotlin code is calling into an annotated API in the SDK. According to Google, Kotlin will surpass Java as of December 2018. In fact, 20% of the Android apps built on Java were migrated on Kotlin. In this blog post, we will discuss more on why Google is supporting Kotlin this much.
Why is the Android App Development Industry Moving from Java to Kotlin?
Kotlin is statically typed and is created to solve similar problems that Java do. Kotlin is fully interoperable with Java code and it is possible to call Kotlin code from Java and vice versa. But Kotlin comes with a syntax that is much cleaner than Java. Even in terms of code readability and functional programming, Kotlin seems to be simpler and better than Java.
Talking about user experience, Kotlin makes apps more stable by eliminating bugs and reducing the chances of app crashes. Also, Kotlin Android Apps are concise. This means Kotlin can solve more problems with fewer lines of code.
Here is a list of hot-shot brands that moved from Java to Kotlin:
- Spring by Pivotal
- Atlassian | Trello
- Basecamp 3
- Twidere for Twitter
- Simple Calendar
So what’s up with Android pie?
Google was the first to announce the devices that would receive the Android pie update; the devices included Pixel, Pixel Xl, Pixel 2, and Pixel 2XL. Shockingly Google excluded nexus from the list. Also, the users of Android One that was released after October 2017 will also receive the updates. Here is a list of other key players in the Android space who will roll out Android pie updates to their devices.
Android pie in Sony Xperia
Sony recently confirmed that the Xperia will get Android pie. Earlier when the OS version was rolled out, 6 Sony devices will receive the update but Xperia was not included in the list. In a recent blog post, Sony confirmed that Xperia devices will receive Android pie updates. Here is a list of 9 Xperia devices that would feature Android pie:
- Sony XA2
- Sony XA2 Ultra
- Sony XA2 Plus
- Sony Xperia XZ2
- Sony Xperia XZ Premium
- Sony XZ1
- Sony XZ1 Compact
- Sony XZ2 Premium
- Sony XZ2 Compact
The update reception date for the users of these 9 devices has not been confirmed yet. But tentatively, the updates for Xperia XZ2, XZ2 Premium, Xperia XZ Premium, XZ2 Compact, and XZ1 Compact will be rolled out in the early days of November 2018. The uses of the remaining devices have to wait till 2019.
Android Pie in Nokia
Nokia recently tweeted a list of its phones that would receive Android pie updates and the list included:
- Nokia 3
- Nokia 6
- Nokia 5
- Nokia 7 plus
- Nokia 8
Nokia is planning to roll out the updates in a phased manner. This is to ensure security. Android Pie would bring AI and machine learning using which the OS will learn about the phone usage and optimise the battery life and other important features accordingly.
Android Pie in Motorola
The company announced a list of devices that would receive Android pie updates in a blog post. Motorola announced that the Android pie update will bring with it battery optimisations, a revamped split-screen multitasking, settings panel with a new design, quick settings, new navigation, new view for recent apps, and easier ways to manage notifications. The list of Motorola devices to receive Android 9 updates include:
- Moto G6
- Moto G6 Play
- Moto G6 Plus
- Moto Z3
- Moto Z3 Play
- Moto Z2 Play
- Moto Z2 Force
- Moto X4
The blog post said that the devices will receive the updates this fall, however, a clear date was not mentioned.
Samsung did not give a clear indication about the timeline of update roll out. To mention Samsung Galaxy S8 users in the UK received Android Oreo updates only this march. So probably Android pie update will follow the same fashion and might reach out to devices in 2019.
Xiaomi’s Redmi Note 4, Redmi 4X, Mi3 and Mi 4 recently got fairly stable ports for Android pie. Also, the Asus Zenfone Max pro M1 is receiving the ports. HTC’s list of devices includes HTC U11, HTC U11 Life, HTC U11+, and HTC U12+. Talking about OnePlus, all the devices from OnePlus 3 and above will receive the Android 9 updates.
How Kotlin dates back to 2010
Though the official release of Kotlin took place only last year, the language has a history that dates back to 2010. It was built by a Czech company called JetBrains. The company makes software for programmers, developers and project managers. To mention, the team at JetBrains didn’t build Kotlin to sell. They created Kotlin to solve their own issues.
More than 70% of its products were built using Java, said Hadi Hariri, a developer evangelist in JetBrains. The remaining were written in Microsoft made C# language. The team encountered a lot of people to like in C# and were getting a little bored of Java’s old-fashioned methodologies. Using Java only means writing up lots of code that the other languages would tend to manage automatically. Something really simple as printing t”Hello World” can take up to 3 lines of code in Java. But it modern languages it only three words in modern.
This only means that the extra effort and much of it is fairly repetitive. Also, the extra code verbosity in programming lingo turns programs cluttered and increases the vulnerability to make mistakes. The biggest problem with programming languages is when you look at the code, you have to figure out what the code would do. It ends up translating into a more of noise which isn’t necessary to get insights of the issue it’s trying to solve.
The JetBrains team wanted to use a modern language, but still, they had many apps written in Java and those apps required maintenance. It was not very practical to rewrite all of the existing Java apps in C# or a similar language. All they needed was a language compatible with Java. This way they would be enabled to add new features to old apps using the new language without having to completely rewrite the apps from scratch.
A few similar options already existed. For example, Scala was gaining momentum at the time. But that was not as simple or fast as the JetBrains team wanted. According to them, it was a really powerful language that and if misused, could result in disastrous consequences.
So the JetBrains crew decided to build their own language which will have all the features they want including a strong compatibility with Java. Rather than keeping the project internal, JetBrains preferred to open-source the project. JetBrains does not profit directly from Kotlin’s usage among developers, but still, the company hopes to generate revenue off of it using the increased interest in their Kotlin-supported core products. Most importantly, JetBrains benefits from rolling out Kotlin for free in the form of feedback and improvements from the larger Java community.
The company rolled out a preview version of the Kotlin language in 2011, and it ended up catching many other people’s attention who was looking for something along the lines. One of them is Jake Wharton, an Android engineer at the payments company Square. Jake has been following Kotlin since its early stages.
In 2015, Jake prepared a document and explained to his superiors at Square why they should approve his Kotlin use. He then published the paper and soon many other people started using it.
Kotlin statistics you can’t ignore
Kotlin usage has increased 2 times six months after Google’s official announcement. According to Google’s product manager James Lau, over 70% of Android studio 3.0 projects run on Kotlin. This is in line with the Realm’s report that predicted that 50% of Android apps will be developed in Kotlin by the end of December 2018. 20% of Android apps are being ported from Java to Kotlin. According to Techcrunch, 28 out of the 100 Android apps in Google’s play store already use Kotlin.
Two researchers in the University of Valenciennes examined a repository of open source Android apps and found out that a short of 12% were using Kotlin. This seemed to be in sync with Google’s estimate of 17%.surprisingly, 35% out of the 12%, use nothing but Kotlin. This means 4% of the overall apps only use Kotlin. No wonder that wired.com calls Kotlin the conqueror of Silicon Valley.
Why would developers love Kotlin?
Kotlin is making Android App Development a breeze for the developers. It is easy to use besides featuring a strong support community of developers. A fail-fast system (which is an important aspect of the language) spontaneously reports any issue it encounters. This helps developers understand issues in the early stages before they move ahead with the mobile app development process. Kotlin reduces the number of boilerplate codes and eventually boosts up productivity to a good level. Kotlin averts the common programming mistakes, resulting in the reduction of app crashes and system failures. Overall, Kotline is safer, more reliable and has, less room for error.
Learn to use the new “Kotlin-friendly” Android pie SDK
To use the new Android pie Kotlin friendly SDK, follow the steps listed below:
- Step 1: In Android Studio Go to Tools > SDK Manager.
- Step 2: Select Android SDK from the left menu,
- Step 3: Check Android 8.+ (P)
- Step 4: Click on OK.
(This will install Android SDK Platform 28 revision 6 if not already installed)
5. Step 5: Set project’s compile SDK version to API 28.
Now you can start using the updated Android Pie SDK with nullability annotations.
If Kotlin plugin in Android Studio is not updated, you will manually have to update it. This is how you go about it: Tools > Kotlin > Configure Kotlin Plugin Updates.
Wrapping it up,
According to Pusher’s survey, 79.5 percent of techies use Kotlin in the context of Android. 31 % rely on Kotlin for backend or server related work. 30.5 % use it in the context of libraries, and 5.5% use it for “other” activities. It is evident that Kotlin is clearly driving the Android ecosystem right now, and clearly, anything Google’s support to facilitate Kotlin development is a good move.
If you are planning to get listed among the successful businesses that moved from Java to Kotlin, DeveloperOnRent Will help you hire Android app developers. Hiring an Android app developer will become a breeze for us.
Experienced Digital Marketing professional with a demonstrated history of working in the information technology and services industry. Skilled in Search Engine Optimization (SEO), Landing Page Optimization, Adwords, Search Engine Marketing, HTML, CSS, WordPress, and Social Media Optimization (SMO). Now working with DeveloperOnRent a fast growing IT outsourcing Company