Anko: The Ultimate Ninja of Kotlin Libraries? • Kai Koenig • YOW! 2016

Learn how ANKO library supercharges Android development with Kotlin, reducing boilerplate through DSLs, simplified SQLite handling & improved async programming.

Key takeaways
  • ANKO is a Kotlin library for Android development that aims to reduce boilerplate code and make development faster and easier

  • Key features include:

    • Layout DSL to replace XML layouts with Kotlin code
    • SQLite database handling with reduced boilerplate
    • Async task handling with simplified syntax
    • Intent and service wrappers
    • Configuration qualifiers for conditional code execution
  • ANKO’s Layout DSL advantages:

    • More concise than XML layouts
    • Type-safe building of UI components
    • Better compile-time error checking
    • Can separate UI code into component classes
  • ANKO leverages important Kotlin features:

    • Extension functions
    • Type-safe builders
    • Lambda expressions
    • Data classes
  • Alternatives to consider:

    • Kandroid for more Android-specific extensions
    • Covenant for more complex promise-based async operations
    • XML layouts for simpler cases
  • Production readiness:

    • Very stable despite being pre-1.0
    • Active development and improvement
    • Used extensively by JetBrains internally
    • Apache licensed and open source
    • Good tooling support in Android Studio/IntelliJ
  • Integration:

    • Simple Gradle dependency addition
    • Modular design allows picking specific features
    • Works with both activities and fragments
    • Can incorporate existing XML layouts