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.