Paul Krill
Editor at Large

Android SDK cozies up to Kotlin

news
Aug 9, 20182 mins

Nullability annotations accompany the Android 9 Pie debut

android p main
Credit: Ryan Whitwam/IDG

With the August 6 production debut of the Android 9 Pie mobile OS, Google has released an Android SDK with special capabilities for development with the Kotlin language.

The SDK has nullability annotations for frequently used APIs, preserving null-safety guarantees when Kotlin code is calling into annotated APIs in the SDK. To ensure that newly annotated APIs are compatible with existing code, an internal mechanism provided by the Kotlin compiler team marks APIs as recently annotated. These APIs result in warnings instead of errors from the Kotlin compiler. Developers need to use Kotlin 1.2.60 or later.

The intention is for newly added nullability annotations to only produce warnings, with the severity level increased to errors starting in a subsequent SDK. Google wants to give developers time to update their code by this stepped error messaging.

Google has endorsed Kotlin for use in building Android applications. But nullability annotations also can benefit developers using Java, the traditional language of Android development, if they use the Android Studio IDE to find nullability contract violations. Plans call for adding more nullability annotations to existing Android APIs in future versions of the SDK as well as ensuring new APIs are annotated.

Where to download the Kotlin-friendly Android SDK

You can download the Android SDK by choosing Tools > SDK Manager in Android Studio and selecting Android SDK on the left menu. The SDK Platforms tab must be open. Check Android 8.+ and click OK to install Android SDK Platform 28 revision 6. Then, set a project’s compile SDK version to API 28. You can download Android Studio from the project website.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author