Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
How to Build Android Applications with Kotlin
How to Build Android Applications with Kotlin

How to Build Android Applications with Kotlin: A hands-on guide to developing, testing, and publishing production-grade Android 16 apps , Third Edition

Arrow left icon
Profile Icon Alex Forrester Profile Icon Eran Boudjnah Profile Icon Alexandru Dumbravan Profile Icon Jomar Tigcal
Arrow right icon
$29.99
eBook Sep 2025 654 pages 3rd Edition
eBook
$29.99
Paperback
$37.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Alex Forrester Profile Icon Eran Boudjnah Profile Icon Alexandru Dumbravan Profile Icon Jomar Tigcal
Arrow right icon
$29.99
eBook Sep 2025 654 pages 3rd Edition
eBook
$29.99
Paperback
$37.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$29.99
Paperback
$37.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

How to Build Android Applications with Kotlin

Creating Your First App

This chapter is an introduction to Android, where you will set up the Android Studio environment and focus on the fundamentals of Android development.

You will cover creating an Android project with Android Studio. Then, you will set up a virtual device and run your app on it. You will explore the Android manifest file, which details all the Android app components, features, and permissions model. You will learn how to use the Gradle build system and analyze the Android application structure. You will start developing user interfaces (UIs) with the Android UI toolkit, Jetpack Compose.

By the end of this chapter, you will have gained the knowledge required to create an Android app from scratch and install it on a virtual Android device. You will be able to analyze and understand the importance of the AndroidManifest.xml file. You will know how an app project is structured in Android Studio and use the Gradle build tool to configure and build your app...

Join our book community on Discord

A qr code with an orange square and a white symbol

https://packt.link/EarlyAccessCommunity

This chapter is an introduction to Android, where you will set up the Android Studio environment and focus on the fundamentals of Android development.You will cover creating an Android project with Android Studio. Then, you will set up a virtual device and run your app on it. You will explore the Android manifest file, which details all the Android app components, features and permissions model. You will learn how to use the Gradle build system and analyze the Android application structure. You will start developing user interfaces (UIs) with the Android UI toolkit, Jetpack Compose.By the end of this chapter, you will have gained the knowledge required to create an Android app from scratch and install it on a virtual Android device. You will be able to analyze and understand the importance of the AndroidManifest.xml file. You will learn how an app project is structured in Android Studio and use...

Technical requirements

The complete code for all the exercises and the activity in this chapter is available on GitHub at https://github.com/PacktPublishing/How-to-Build-Android-Apps-with-Kotlin-Third-Edition/tree/main/Chapter01.

Creating an Android project with Android Studio

In order to be productive building Android apps, it is essential to become confident with using Android Studio. This is the official integrated development environment (IDE) for Android development, built on JetBrains’ IntelliJ IDEA IDE and developed by the Android Studio team at Google. You will use it throughout this course to create apps and progressively add more advanced features.Since Google I/O 2017 (the annual Google developer conference), Kotlin has been Google’s preferred programming language for Android app development. You will be using Kotlin throughout this book to build Android apps.Kotlin was created to address some of the shortcomings of Java in terms of verbosity, handling null types, and adding more functional programming techniques, amongst many other issues.Getting to grips and familiarizing yourself with Android Studio will enable you to feel confident building Android apps. So, let’...

Setting up a virtual device and running your app

As a part of installing Android Studio, you downloaded and installed the latest Android software development kit (SDK) components. This includes a base emulator, which you will configure to create a virtual device to run Android apps on. An emulator mimics the hardware and software features and configuration of a real device. The benefit is that you can make changes and quickly see them on your desktop while developing your app. Although virtual devices do not have all the features of a real device, the feedback cycle is often quicker than going through the steps of connecting a real device.The screen you will have seen (or something similar) when installing Android Studio is as follows:

Figure 1.4 – SDK components

Let’s take a look at the SDK components that are installed and how the virtual device fits in:

  • Android Emulator: This is the base emulator, which...

The Android manifest file

The app you have just created, although simple, encompasses the core building blocks that you will use in all the projects you create. The app is driven from the AndroidManifest.xml file, a manifest file that details the contents of your app. To open it, locate the tool window by selecting View | Tool Windows | Project. Once displayed, the drop-down options on the top of the Project window allow you to change the way you view your project, with the most commonly used displays being Android and Project:

Figure 1.14 – The Tool Windows drop-down menu

The AndroidManifest.xml file is located at app | manifests in the Android display of the Project window:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="
        http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <application...

Using Gradle to build, configure, and manage app dependencies

In the course of creating this project, you have principally used the Android platform SDK. The necessary Android libraries were downloaded when you installed Android Studio. However, these are not the only libraries that are used to create your app. To configure and build your Android project or app, a build tool called Gradle is used.Gradle is a multi-purpose build tool that Android Studio uses to build your app. You can either use Kotlin or Groovy, a dynamically typed Java virtual machine (JVM) language, to configure the build process and allow easy dependency management so you can add libraries to your project and specify the versions.As the default language when creating a new project in Android Studio is Kotlin, you will be using this. The files that this build and configuration information is stored in are named build.gradle.kts, which are Kotlin script files. You benefit from the same autocompletion and...

Android application structure

Now that we have covered how the Gradle build tool works, we’ll explore the rest of the project. The simplest way to do this is to examine the folder structure of the app. Open up the Project tool window.When you select it, you will see a view like the screenshot in Figure 1.17. If you can’t see any window bars on the left-hand side of the screen, then go to the top toolbar and select View | Appearance | Tool Window Bars and make sure it is ticked.Open the corresponding folders in the Android display. This view neatly groups the app folder structure, so let’s look at it:

Figure 1.17 – Overview of the files and folder structure in the app

The Kotlin file (MainActivity), which you’ve specified as running when the app starts, is as follows:

import…
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
 ...

Summary

This chapter has covered a lot about the foundations of Android development. You started with how to create Android projects using Android Studio and then created and ran apps on a virtual device.The chapter then progressed by exploring the AndroidManifest file, which details the contents of your app and the permission model, followed by an introduction to Gradle and the process of adding dependencies and building your app.This was then followed by going into the details of an Android application and the files and folder structure. Jetpack Compose was introduced, and exercises iterated to illustrate how to construct UIs with an introduction to Google’s Material Design.The next chapter will build on this knowledge by learning about the activity life cycle, activity tasks, and launch modes, persisting and sharing data between screens, and how to create robust user journeys through your app

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Build real-world Android apps with Kotlin and the Jetpack Compose UI framework
  • Leverage the latest libraries to accelerate your Android development
  • Overcome development challenges with tips and tricks from experienced Android professionals
  • Get With Your Book: PDF Copy, AI Assistant, and Next-Gen Reader Free

Description

Written by four veteran developers with 60+ years of collective experience, this updated third edition will jumpstart your Android development journey, focusing on Kotlin libraries and Jetpack Compose, Google’s powerful declarative UI framework. You’ll learn the fundamentals of app development, enabling you to use Android Studio, as well as get to grips with Jetpack Compose to create your first screens, build apps to run them on virtual devices through guided exercises, and implement Jetpack Compose’s layout groups to make the most of lists, images, and maps. The book has been updated with Kotlin’s powerful networking and coroutines libraries to help you fetch data in the background from a web service and manage displaying the data using Kotlin flows. You’ll learn about testing, creating clean architecture, and persisting data, as well as exploring the dependency injection pattern and learning how to publish your apps on the Google Play Store. You'll also work on realistic projects split up into bite-size exercises and activities, along with building apps to create quizzes, read news articles, check weather reports, store recipes, retrieve movie information, and remind you where you parked your car. By the end of this book, you'll have gained the skills and confidence to build your own creative Android apps using Kotlin.

Who is this book for?

This book is for beginners as well as intermediate-level developers with no prior experience in Android app development. Basic knowledge of the Kotlin programming language or experience in a similar programming language, along with a willingness to brush up on Kotlin is required.

What you will learn

  • Create maintainable and scalable apps using Kotlin
  • Grasp Android asynchronous programming with coroutines and the Flow API
  • Simplify app development with Google architecture components
  • Apply MVVM and Repository architecture patterns to standardize retrieving and displaying data from outside sources
  • Increase app stability and robustness with unit and integration tests
  • Use standard libraries for dependency injection, networking, data parsing, and persistence
  • Publish your app on the Google Play Store

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 05, 2025
Length: 654 pages
Edition : 3rd
Language : English
ISBN-13 : 9781835882771
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 05, 2025
Length: 654 pages
Edition : 3rd
Language : English
ISBN-13 : 9781835882771
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Table of Contents

23 Chapters
Android Foundation Chevron down icon Chevron up icon
Creating Your First App Chevron down icon Chevron up icon
Building User Screen Flows Chevron down icon Chevron up icon
Developing the UI with Jetpack Compose Chevron down icon Chevron up icon
Building App Navigation Chevron down icon Chevron up icon
App Components Chevron down icon Chevron up icon
Essential Libraries – Ktor, Kotlin Serialization, and Coil Chevron down icon Chevron up icon
Building Lists with Jetpack Compose Chevron down icon Chevron up icon
Android Permissions and Google Maps Chevron down icon Chevron up icon
Services, WorkManager, and Notifications Chevron down icon Chevron up icon
Code Structure Chevron down icon Chevron up icon
Testing with JUnit, Mockito, MockK, and Compose Chevron down icon Chevron up icon
Coroutines and Flow Chevron down icon Chevron up icon
Android Architecture Components Chevron down icon Chevron up icon
Persisting Data Chevron down icon Chevron up icon
Dependency Injection with Dagger, Hilt, and Koin Chevron down icon Chevron up icon
Polishing and Publishing an App Chevron down icon Chevron up icon
Architecture Patterns Chevron down icon Chevron up icon
Advanced Jetpack Compose Chevron down icon Chevron up icon
Launching Your App on Google Play Chevron down icon Chevron up icon
Unlock Your Book’s Exclusive Benefits Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon