If you're interested in using Kotlin, it's easy to get started because it works side by side with Java and C++ on Android. So you can keep your existing code, continue to use the various Android libraries, and incrementally add Kotlin code to your project. Unlike almost any other language, Kotlin is a drop-in replacement you can use bi-directionally—you can call into the Java language from Kotlin, and you can call into Kotlin from the Java language.
- 有着JetBrains公司（Kotlin发明者）的大力支持，Android Studio3.0起会内置Kotlin开发工具
Of course, IDE support is also crucial, and we have it. Android Studio is built upon IntelliJ IDEA, an IDE built by JetBrains—the same company that created the Kotlin language. The JetBrains team has been working for years to make sure Kotlin works great with IntelliJ IDEA. So we're inheriting all their hard work. Starting with Android Studio 3.0, tooling support for Kotlin is bundled directly into Android Studio.
We believe Kotlin is an excellent fit for Android not only because it gives developers what they want, but also because it matches the spirit of Android. Just like Android, Kotlin has always been an open source project, primarily under Apache 2. It involves an entire community and does not belong to just one company. So we're working with JetBrains to move Kotlin into a non-profit foundation. Our choice of Kotlin reaffirms our commitment to an open developer ecosystem as we evolve and grow the Android platform, and we are excited to see the language evolve.
And while we're adding Kotlin as an official Android language, we're also expanding our investment in our existing languages. For example, in Android O we added support for more Java 8 libraries. In Android Studio 3.0, Java 8 language features are now directly supported with the javac compiler. And on C++, we're making ongoing investments such as expanding performance profiling tools and APK debugging tools to fully cover the native experience; and significantly improving libc support and updating the NDK to ensure you can access modern headers even when you target older APIs.
- 如果想要方便的体验使用Kotlin开发Android，建议下载Android Studio3.0预览版，在2.3.2版本上需要下载Kotlin相关插件
新建工程，勾选“Include Kotlin support”
创建Activity，Source Language选择“Kotlin”（也可以使用Code->Convert Java File to Kotlin File直接转换MainActivity.java）
Debugging Kotlin works just like debugging Java code. You don't need to do anything differently.
Yes. Kotlin provides Java language interoperability. This is a design that allows Kotlin code to transparently call Java language methods, coupled with annotations that make it easy to expose Kotlin-only functionality to Java code. Kotlin files that don't use any Kotlin-specific semantics can be directly referenced from Java code without any annotations at all. Combined, this allows you to granularly mix Java code with Kotlin code.
Yes, JNI is fully supported with Kotlin. Simply mark the JNI method with the external modifier.
The Kotlin runtime adds about 7,000 methods and ~1MB to your debug APK. The net impact might be less if you use Kotlin to replace another library in your project, such as Guava or RxJava. This size also reduces when you optimize the APK for release with Proguard, just like other app code and libraries.
Kotlin doesn't have a direct performance impact, but just as with the Java language, you should be thoughtful about how you use it. For example, repeated copying between new collection instances can impact GC performance, and calling a method that accepts non-null types adds a method call for the null check (though you can disable runtime null checks in the compiler with -Xno-param-assertions).