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
$49.99
Paperback Sep 2025 654 pages 3rd Edition
eBook
$35.98 $39.99
Paperback
$49.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
$49.99
Paperback Sep 2025 654 pages 3rd Edition
eBook
$35.98 $39.99
Paperback
$49.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$35.98 $39.99
Paperback
$49.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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

Shipping Address

Billing Address

Shipping Methods
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
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

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 : 9781835882764
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Sep 05, 2025
Length: 654 pages
Edition : 3rd
Language : English
ISBN-13 : 9781835882764
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

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon