$30 off During Our Annual Pro Sale. View Details »

Android Development in 2023

Android Development in 2023

There has been a lot of progress done in and for Android Development. Support for large screens and form factors, wearOs and Compose TV, new updates in Kotlin like K2 complier, KSP, Kotlin Multiplatform and more updates coming to Jetpack and more. In this talk, we'll highlight the new updates, new library releases as well as updates in Android Studio.

Making Android Development better than before!

Cheers

Beatrice Kinya

July 29, 2023
Tweet

More Decks by Beatrice Kinya

Other Decks in Technology

Transcript

  1. Beatrice Kinya
    GDE for Android
    Android Engineer
    Also, I create content @Kodeco
    Twitter: @B__Kinya | LinkedIn: Beatrice Kinya

    View Slide

  2. Android Development
    in 2023
    Android | Kotlin | Jetpack

    View Slide

  3. Language

    View Slide

  4. Kotlin
    - 2017: Officially supported language for Android.
    - Google I/0 2019: Google announced Kotlin as the first class language for Android
    Development.
    - New libraries, development tools and guidelines are now designed in Kotlin, for
    instance Jetpack Compose.
    - Android ❤ Kotlin:
    - Kotlin is safe, concise and expressive
    - Structured concurrency offered by coroutines

    View Slide

  5. K2 Compiler
    - Now in Beta , in Kotlin 1.9.0 release
    - Better builds and improved IDE performance. It’s twice faster compared to Kotlin
    1.8 compiler.
    - Default for Kotlin 2.0

    View Slide

  6. K2 Compiler
    - Starting with Kotlin 1.9.0, you can test K2 compiler using
    kotlin.experimental.tryK2=true gradle property. Use the following
    command on command line
    ./gradlew assemble -Pkotlin.experimental.tryK2=true
    - Or Update language version from modules build.gradle file

    View Slide

  7. View Slide

  8. Kotlin DSL for Gradle Builds
    - Gradle Kotlin DSL is an alternative syntax to Groovy DSL for writing gradle build
    scripts.
    - Advantages include code completion, navigating to source ,syntax highlighting and
    type and method documentation.

    View Slide

  9. Kotlin DSL for Gradle Builds
    - Starting Android Studio Giraffe Kotlin DSL will be the default DSL for writing
    Gradle Build Scripts
    - Android Studio Giraffe offers Gradle version catalog an an experimental option.
    - Gradle Version Catalog provides a centralised place for managing dependencies.

    View Slide

  10. KSP
    - Kotlin Symbol processing(KSP), a better alternative to Kotlin Annotation
    Processor(KAPT)
    - KAPT generates Java stubs from Kotlin code to allow annotation processors written
    for Java to work with Kotlin code. This is time consuming
    - KSP, a first alternative for Kotlin, directly analyses Kotlin Code.
    - It’s 2X faster. It does not generate Java stubs
    - It provides better typing. It better understands kotlin constructs and types such as
    nullability.
    - It’s multi-platform ready

    View Slide

  11. Kotlin Multiplatform
    - Kotlin Multiplatform simplifies development of cross-platform projects.
    - It allows sharing code across different platforms while retaining the benefits and
    flexibility of native programming.
    - Now in Beta
    - Jetpack Libraries supporting Kotlin multi-platform
    - Collections
    - Annotations
    - Datastore

    View Slide

  12. Large Screens and Form Factors

    View Slide

  13. Pixel Tablet and Pixel Fold

    View Slide

  14. Jetpack Compose
    - Pager and flow layouts for designing adaptive ui layouts across different screen
    sizes
    - Flow layouts are similar to Row and Column.
    - They differ in that items move to the next line when container runs out of space.
    - You can also use LazyGrid layouts.

    View Slide

  15. View Slide

  16. Window Size Class
    - androidx.compose.material3.windowsizeclass library enables you observe
    device window size class so that you can build adaptive ui layouts easily.
    - Window size classes include : small, medium and large

    View Slide

  17. Window State
    - Jetpack WindowManager library help developers adapt their apps to a
    multi-window environments.
    - Activity embedding used in a multi-activity apps design adaptive layouts for
    different screen sizes.
    - In 1.1 release of Jetpack WindowManager, activity embedding is no longer
    experimental
    - Window layout library allows you to determine features of app display window
    such as fold posture and orientation.
    Check out this article to learn how to build adaptive apps for large screens and
    foldables: https://www.kodeco.com/34785195-large-screens-foldables-tutorial-for-android

    View Slide

  18. Glance
    - Jetpack Glance library enables you to develop widgets customized for android
    phones, tablets and foldables.
    - Glance simplifies implementation of interactive and responsive widgets

    View Slide

  19. Wear OS
    - Compose for Wear OS 1.1 stable was released December last year.
    - 1.2 release is currently in alpha with new features like:
    - The placeholder and placeholderShimmer add elegant loading
    animations that can be used on chips and cards while content is loading.
    - expandableItems make it possible to fold long lists or long text, and only
    expand to show their full length upon user interaction.
    - Android studio lets you preview multiple watch screen and text sizes.
    - And more ..

    View Slide

  20. Compose for TV
    - An alpha release of Androidx TV library
    - Compose for TV allows to build intuitive TV apps using less code and an intuitive,
    powerful and flexible API.
    - Compose for TV comes with variety of components you can use alongside material
    components
    - TvLazyRow, TvLazyColumn, TvLazyGrid for scrollable content.
    - TabRow & Tab and NavigationDrawer for navigation
    - ImmersiveList
    - Carousel

    View Slide

  21. Jetpack

    View Slide

  22. Jetpack
    - Jetpack is a suite of libraries, tools and guidelines to help developers develop
    robust android apps, while writing code that works consistently across different
    android versions and devices.
    - The libraries can be grouped into 3 major categories
    - Architecture libraries
    - Performance Optimization
    - User Interface libraries

    View Slide

  23. Architecture Libraries
    ❖ Room
    ➢ @Upsert annotation added in Room 2.5.0
    ➢ Support for value classes for KSP. This is available starting from Room 2.6.0-alpha01
    ❖ WorkManager
    ➢ Update WorkRequest that’s already enqueued while maintaining original enqueue time and chaining.
    ➢ updateWork() API allows you to update existing work request without having to manually cancel and create a
    new work request.
    ➢ Available WorkManager 2.8.0
    ❖ DataStore
    ➢ DataStore 1.1-alpha
    ➢ Support for KMM
    ➢ Accessing DataStore from multiple processes while providing data consistency between the proccess
    ❖ Lifecycle
    ➢ CollectAsStateWithLifecycle API
    ➢ Released in lifecycle 2.6.0

    View Slide

  24. Performance
    - Have you heard about baseline profile?
    - Check out Baseline Profile library and learn how you can improve your app start-up
    time.
    - And Macrobenchmark library to monitor and improve the performance of your
    app.

    View Slide

  25. Material 3
    - Recommended design system for Android apps
    - 1.1 stable release.
    - Added new components
    - Bottom Sheet
    - Date and time picker
    - Search bar
    - Flow layouts

    View Slide

  26. Tooling

    View Slide

  27. Android Studio Giraffe
    - Now Stable
    - Live edit on both the emulator and physical device without rebuilding or
    redeploying your app.
    - Support for new animations APIs in Animation preview so you can debug any
    animations using animate*AsState, CrossFade,
    rememberInfiniteTransition, and AnimatedContent.
    - Compose preview supports live updates from multiple files.
    - Improved auto-complete behavior

    View Slide

  28. Android Studio Giraffe
    - Resizable emulator now includes different foldable postures: folded, unfolded and
    book posture

    View Slide

  29. Android Studio Hedgehog
    - Now in Canary 14
    - Showing compose state information in the debugger. It’ll show you which
    parameters changes, the ones that remained unchanged making it efficient to
    investigate recompositions.
    - Check out this talk by Ben Trengrove to learn more: Debugging Jetpack Compose
    - Android Studio Bot
    - A new Espresso Device Api that lets you apply rotation changes, fold posture and
    other configuration changes to the virtual device under test.

    View Slide

  30. Android Studio Hedgehog: Compose Multiple Preview template
    - androidx.compose.ui:ui-tooling-preview 1.6.0-alpha01+ introduces new
    multi preview API templates: @PreviewScreenSizes, @PreviewFontScales,
    @PreviewLightDark, and @PreviewDynamicColors
    - With a single annotation you can preview your compose UI with different common
    scenarios.

    View Slide

  31. View Slide

  32. Resources, and a lot more from the Android Community

    View Slide

  33. Resources

    View Slide

  34. Resources
    - https://medium.com/androiddevelopers/consuming-flows-safely-in-jetpack-compose-cde014d0d5a3
    - https://android-developers.googleblog.com/2023/05/building-pixel-perfect-living-room-experiences-co
    mpose-for-tv.html
    - https://www.kodeco.com/34785195-large-screens-foldables-tutorial-for-android#toc-anchor-005
    - https://developer.android.com/jetpack/androidx/releases/window#1.1.0-beta01
    - https://developer.android.com/jetpack/androidx/releases/glance
    - https://developer.android.com/build/migrate-to-ksp
    - https://jorgecastillo.dev/course/
    - https://www.amazon.com/Modern-Android-Development-Cookbook-applications-ebook/dp/B0B9YN7
    M41/ref=sr_1_6
    - https://practicaljetpackcompose.com/

    View Slide

  35. Questions

    View Slide