Bird
Raised Fist0
Android Kotlinmobile~15 mins

APK vs App Bundle in Android Kotlin - Build Both & Compare

Choose your learning style10 modes available
Build: App Package Info
This screen shows the difference between APK and App Bundle formats used in Android app distribution.
Target UI
---------------------------------
|       App Package Info         |
---------------------------------
| Format:                       |
| [APK]                        |
| Description:                 |
| Android Package Kit file.    |
| Contains all app resources.  |
|                             |
| Format:                       |
| [App Bundle]                 |
| Description:                 |
| Google Play app publishing   |
| format. Optimizes downloads. |
---------------------------------
Display two sections: one for APK and one for App Bundle.
Each section must have a title and a short description.
Use a vertical scrollable layout.
Use simple TextViews with clear labels.
Add a header with the screen name.
Starter Code
Android Kotlin
package com.example.apppackageinfo

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

class MainActivity : ComponentActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContent {
      AppPackageInfoScreen()
    }
  }
}

@Composable
fun AppPackageInfoScreen() {
  Scaffold(
    topBar = { TopAppBar(title = { Text("App Package Info") }) }
  ) { paddingValues ->
    Column(
      modifier = Modifier
        .padding(paddingValues)
        .padding(16.dp)
        .verticalScroll(rememberScrollState())
    ) {
      // TODO: Add APK section
      // TODO: Add App Bundle section
    }
  }
}
Task 1
Task 2
Task 3
Task 4
Task 5
Solution
Android Kotlin
package com.example.apppackageinfo

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp

class MainActivity : ComponentActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContent {
      AppPackageInfoScreen()
    }
  }
}

@Composable
fun AppPackageInfoScreen() {
  Scaffold(
    topBar = { TopAppBar(title = { Text("App Package Info") }) }
  ) { paddingValues ->
    Column(
      modifier = Modifier
        .padding(paddingValues)
        .padding(16.dp)
        .verticalScroll(rememberScrollState())
    ) {
      Text("Format: APK", fontWeight = FontWeight.Bold, style = MaterialTheme.typography.titleMedium)
      Text("Android Package Kit file. Contains all app resources.", modifier = Modifier.padding(top = 4.dp))
      Spacer(modifier = Modifier.height(24.dp))
      Text("Format: App Bundle", fontWeight = FontWeight.Bold, style = MaterialTheme.typography.titleMedium)
      Text("Google Play app publishing format. Optimizes downloads.", modifier = Modifier.padding(top = 4.dp))
    }
  }
}

This app screen uses Jetpack Compose to show two sections describing APK and App Bundle formats.

We use a Scaffold with a TopAppBar for the header.

The content is inside a vertically scrollable Column with padding.

Each section has a bold title and a description below it with spacing between sections for clarity.

This simple layout helps beginners understand the difference visually.

Final Result
Completed Screen
---------------------------------
|       App Package Info         |
---------------------------------
| Format: APK                   |
| Android Package Kit file.     |
| Contains all app resources.   |
|                              |
| Format: App Bundle            |
| Google Play app publishing    |
| format. Optimizes downloads.  |
---------------------------------
User can scroll vertically if screen is small.
No buttons or navigation, just static info.
Stretch Goal
Add a toggle button to switch between light and dark theme.
💡 Hint
Use a state variable to track theme mode and apply MaterialTheme color scheme accordingly.

Practice

(1/5)
1. What is the main difference between an APK and an App Bundle in Android development?
easy
A. APK is a publishing format, and App Bundle is the full app file installed on devices.
B. APK is the full app file installed on devices, while App Bundle is a publishing format that generates optimized APKs.
C. APK is only used for testing, and App Bundle is the final app file installed on devices.
D. APK and App Bundle are exactly the same with different names.

Solution

  1. Step 1: Understand APK purpose

    An APK is the actual file installed on Android devices containing the app.
  2. Step 2: Understand App Bundle purpose

    An App Bundle is a publishing format that Google Play uses to generate optimized APKs for different devices.
  3. Final Answer:

    APK is the full app file installed on devices, while App Bundle is a publishing format that generates optimized APKs. -> Option B
  4. Quick Check:

    APK = full app file, App Bundle = publishing format [OK]
Hint: APK is installed file; App Bundle creates device-specific APKs [OK]
Common Mistakes:
  • Confusing APK as only for testing
  • Thinking App Bundle is installed directly
  • Believing APK and App Bundle are identical
2. Which of the following is the correct way to build an Android App Bundle using Gradle command line?
easy
A. gradle bundleRelease
B. gradle assembleDebug
C. gradle buildApk
D. gradle assembleAppBundle

Solution

  1. Step 1: Identify Gradle command for App Bundle

    The correct Gradle task to build an App Bundle is bundleRelease.
  2. Step 2: Check other options

    assembleDebug builds a debug APK, buildApk is not a valid task, and assembleAppBundle is incorrect syntax.
  3. Final Answer:

    gradle bundleRelease -> Option A
  4. Quick Check:

    App Bundle build task = bundleRelease [OK]
Hint: Use 'bundleRelease' to build App Bundle with Gradle [OK]
Common Mistakes:
  • Using assembleDebug which builds APK, not bundle
  • Typing incorrect Gradle task names
  • Confusing assemble and bundle commands
3. Given the following scenario: You upload an App Bundle to Google Play. What happens when a user downloads your app?
medium
A. Google Play generates and delivers an optimized APK for the user's device.
B. The user downloads the entire app as a single APK file.
C. The user downloads multiple APKs and installs them manually.
D. The app is downloaded as source code and compiled on the device.

Solution

  1. Step 1: Understand App Bundle delivery

    When you upload an App Bundle, Google Play generates APKs optimized for the user's device configuration.
  2. Step 2: Check user download process

    The user receives a single optimized APK, not the full app or multiple APKs.
  3. Final Answer:

    Google Play generates and delivers an optimized APK for the user's device. -> Option A
  4. Quick Check:

    App Bundle delivery = optimized APK from Google Play [OK]
Hint: App Bundle lets Google Play create device-specific APKs [OK]
Common Mistakes:
  • Thinking user downloads full APK always
  • Believing multiple APKs are downloaded manually
  • Assuming app is compiled on device
4. You tried to upload an APK to Google Play but got an error saying the file is too large. What is a likely fix related to App Bundles?
medium
A. Increase the APK file size limit in Google Play settings.
B. Rename the APK file to have a smaller name.
C. Switch to using an App Bundle to reduce APK size by device optimization.
D. Remove all images from the APK to reduce size.

Solution

  1. Step 1: Identify cause of large APK error

    Google Play limits APK size; large APKs cause upload errors.
  2. Step 2: Use App Bundle to fix size issue

    App Bundles allow Google Play to generate smaller, optimized APKs per device, reducing size.
  3. Final Answer:

    Switch to using an App Bundle to reduce APK size by device optimization. -> Option C
  4. Quick Check:

    App Bundle reduces APK size for Google Play upload [OK]
Hint: Use App Bundle to fix large APK upload errors [OK]
Common Mistakes:
  • Trying to increase Google Play size limit (not possible)
  • Renaming file does not reduce size
  • Removing images blindly breaks app UI
5. You want to publish an app that supports multiple device configurations (screen sizes, languages, CPU architectures). How does using an App Bundle improve the user experience compared to a single APK?
hard
A. App Bundle requires users to manually select device configurations before installing.
B. App Bundle forces users to download all configurations, increasing app size.
C. App Bundle disables device-specific optimizations to simplify publishing.
D. App Bundle lets Google Play deliver only the code and resources needed for the user's device, saving space and download time.

Solution

  1. Step 1: Understand multi-configuration app challenges

    Supporting many devices usually means a large APK with all resources included.
  2. Step 2: How App Bundle optimizes delivery

    App Bundle lets Google Play generate APKs with only needed code and resources per device, reducing size and improving install speed.
  3. Final Answer:

    App Bundle lets Google Play deliver only the code and resources needed for the user's device, saving space and download time. -> Option D
  4. Quick Check:

    App Bundle = device-optimized delivery for better user experience [OK]
Hint: App Bundle delivers device-specific code and resources [OK]
Common Mistakes:
  • Thinking App Bundle increases app size
  • Believing users must choose configs manually
  • Assuming App Bundle disables optimizations
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard