Google Supports Rust For Android OS Development
Written by Kay Ewbank   
Monday, 12 April 2021

Google has announced that the Android Open Source Project (AOSP) is adding support for Rust as a development language for the Android operating system. The support is being added to help avoid memory safety bugs in the code.

Google advocates the use of managed languages such as Java and Kotlin as the best option for Android app development, because they are designed for ease of use, portability, and safety. The Android Runtime (ART) manages memory on behalf of the developer.

androidlogo

Writing about the new support Google's Jeff Vander Stoep and Stephen Hines of the Android Team said that that

"memory safety bugs in C and C++ continue to be the most-difficult-to-address source of incorrectness. We invest a great deal of effort and resources into detecting, fixing, and mitigating this class of bugs, and these efforts are effective in preventing a large number of bugs from making it into Android releases. Yet in spite of these efforts, memory safety bugs continue to be a top contributor of stability issues, and consistently represent ~70% of Android’s high severity security vulnerabilities."

In view of this, Google is increasing efforts to prevent memory bugs, and memory-safe languages are the best way to achieve this. With this in mind, Google is adding support for Rust to the existing languages supported.

androidlang

The Android OS uses Java extensively, effectively protecting large portions of the Android platform from memory bugs. The developers say that unfortunately, for the lower layers of the OS, Java and Kotlin are not an option. Instead the lower levels of the operating system need systems programming languages like C, C++, and Rust, which are designed with control and predictability as goals, and provide access to low level system resources and hardware.Stoep and Hines said:

"They are light on resources and have more predictable performance characteristics.For C and C++, the developer is responsible for managing memory lifetime. Unfortunately, it's easy to make mistakes when doing this, especially in complex and multithreaded codebases."

Rust avoids these mistakes by providing memory safety guarantees by using a combination of compile-time checks to enforce object lifetime/ownership and runtime checks to ensure that memory accesses are valid. This safety is achieved while providing equivalent performance to C and C++.

androidlogo

More Information

Android Open Source Project

Related Articles

Android Adopts Bazel For Build System

Android Is Kotlin First

Kotlin - New Language For Android

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Google Donates $1M To Rust
26/02/2024

Google has made a donation of $1 million to The Rust Foundation. The contribution has been earmarked to underwrite the Interop Initiative: a new C++/Rust interoperability effort.



WasmCon 2023 Sessions Now Online
01/03/2024

The recorded session of the premier conference for technical developers and users interested in exploring the potential of WebAssembly are now online.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 12 April 2021 )