Mastering Kotlin for Android 14: Build powerful Android apps from scratch using Jetpack libraries and Jetpack Compos [1 ed.] 9781837631711

Written with the best practices, this book will help you master Kotlin and use its powerful language features, libraries

292 49 20MB

English Pages 474 Year 2024

Report DMCA / Copyright

DOWNLOAD EPUB FILE

Table of contents :
Mastering Kotlin for Android 14
Contributors
About the author
About the reviewers
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Share Your Thoughts
Download a free PDF copy of this book
Part 1: Building Your App
1
Get Started with Kotlin Android Development
Technical requirements
Introduction to Kotlin
Kotlin syntax, types, functions and classes
Creating a Kotlin project
Creating functions
Creating classes
Migrating from Java to Kotlin
Kotlin features for Android developers
Summary
2
Creating Your First Android App
Technical requirements
Android Studio overview
Creating your Android app
Exploring the new project
Android Studio tips and tricks
Some useful shortcuts
Summary
3
Jetpack Compose Layout Basics
Technical requirements
Introduction to Jetpack Compose
Declarative versus imperative UIs
Composable functions
Previews
Modifiers
Jetpack Compose layouts
Column
Row
Box
Lists
Summary
4
Design with Material Design 3
Technical requirements
Material Design 3 and its features
Material components
Using Material Design in our apps
Adding Material Design 3 color schemes
Designing UIs for large screens and foldables
Using WindowSizeClass
Making our app accessible
Summary
Part 2: Using Advanced Features
5
Architect Your App
Technical Requirements
Introduction to app architecture
Deep Diving into MVVM
How LazyColumn works
Benefits of LazyColumn
Creating a composable
Jetpack libraries
Dependency injection
Migrating to Kotlin Gradle DSL and using version catalogs
Migrating our app to Kotlin Gradle DSL
Using a versions catalog
Summary
6
Network Calls with Kotlin Coroutines
Technical requirements
Setting up Retrofit
Introduction to Kotlin coroutines
Coroutine basics
Using Kotlin coroutines for network calls
Summary
7
Navigating within Your App
Technical requirements
Jetpack Navigation overview
Navigating to Compose destinations
Passing arguments to destinations
Navigation in foldables and large screens
Creating and using the resizable emulator
Summary
8
Persisting Data Locally and Doing Background Work
Technical requirements
Saving and reading data from a local database
Handling updates and migrations in the Room database
Using WorkManager to schedule background tasks
Testing your workers
Summary
9
Runtime Permissions
Technical requirements
Understanding runtime permissions
Requesting permissions at runtime
Summary
Part 3: Code Analysis and Tests
10
Debugging Your App
Technical requirements
General debugging tips and tricks
Logcat
Stack traces
Breakpoints
Detecting memory leaks with LeakCanary
Inspecting network requests with Chucker
Using App Inspection
Summary
11
Enhancing Code Quality
Technical requirements
Mastering Kotlin style and best practices
Coding conventions
Null safety
Data classes
Extensions functions
Type inference
Collections
Sealed classes and interfaces
Formatting
Functional programming
Coroutines
The when statements
Classes and functions
Using Ktlint for static analysis
Detecting code smells with detekt
Setting up detekt
Customizing detekt
Summary
12
Testing Your App
Technical requirements
Importance of testing
Testing the network and database layers
Testing the network layer
Testing the database layer
Testing our ViewModels
Adding UI tests to our composables
Summary
Part 4: Publishing Your App
13
Publishing Your App
Technical requirements
Preparing our app for release
Add analytics to your app
Add crash reporting to your app
Turn off logging and debugging
Internationalize and localize your app
Improve error messages
Test your app on different devices
Provide proper feedback channels
Reduce the size of your app
Use the Android App Bundle
Enable minification and obfuscation
Releasing our app to the Google Play Store
Creating our first release
An overview of Google Play Store policies
Summary
14
Continuous Integration and Continuous Deployment
Technical requirements
Setting up GitHub Actions
Benefits of CI/CD
How CI/CD works
Setting up GitHub Actions
Running lint checks and tests on GitHub Actions
Deploying to Play Store using GitHub Actions
Summary
15
Improving Your App
Technical requirements
Using Firebase Crashlytics to detect crashes
Setting up Google Analytics
Improving app engagement with Firebase Messaging
Securing your app
Summary
Index
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Download a free PDF copy of this book

Mastering Kotlin for Android 14: Build powerful Android apps from scratch using Jetpack libraries and Jetpack Compos [1 ed.]
 9781837631711

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
Recommend Papers