Inspecting the Compiled App

Our starter project has a bit of code, a bunch of resources, a manifest, and Gradle build instructions. And, we can see the app running on a device or emulator.

However, Android is not running directly that bit of code and other stuff. Android Studio compiles the things in our project into something that Android then runs.

In this chapter, we will take a brief look at what Android Studio is building for us and how we can examine that output, beyond running it on Android.

What We Build

From the user’s standpoint, we are building an app. Usually, that is true. The story can get complicated with specialized scenarios like Android Auto and Android Wear, but we can ignore those for the time being.

From a programming standpoint, what you are creating is an APK, perhaps by way of an app bundle.

APKs

An APK is the Android executable format. It is what gets installed on an Android device, and it is what the device runs.

An APK is a ZIP archive. You can unpack one using your favorite unZIP tool, though we will see a better option for many cases later in this chapter.

The APK will contain:

This includes not only the things that you create yourself but also the stuff that you wind up using from libraries that are part of your app module.

App Bundles

The APK not only is what an Android device runs, but usually it is what Android app developers publish. You use Android Studio to create the APK from your project, and you upload that APK to the Play Store or other app distribution channels. The Play Store or other site then distributes the APK to users.

You will hear Google talk about “app bundles” as an alternative. App bundles are designed for large, complex apps, where only part of what goes in an APK will be relevant for any given device. For example, a major brand APK may have strings translated to many languages, but the user typically uses only one or two languages. Having translations in other languages just takes up disk space and adds no value to that individual user. App bundles allow Google to craft tailored APKs on your behalf that match the needs of individual devices and users.

However, now you are no longer in control over what is in your app. Google is. While Google likes to comment on what they can remove from your app (e.g., unnecessary languages), they do not discuss whether they might add anything to your app or otherwise modify its behavior. That could be for their benefit or for the benefit of some third party.

You will need to decide for yourself whether the benefits of app bundles outweigh the risks. Note, though, that Google has stated that app bundles will be required for new apps being distributed through the Play Store starting in August 2021.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.