Skip to main content

Mobile development · Intermediate · 22 min

Shrink the download size of an Android app built with Expo

By Padding · Updated 18 Nov 2026
Expo SDK 58 · Node.js 26 · node:26 (Debian)

You will measure an Expo SDK 58 app's JavaScript bundle with Expo Atlas, cut a heavy import and an oversized photo, add a size budget that fails when the bundle grows, and add resource shrinking, language filtering and permission blocking to the Android release build, which already runs R8.

On this page

Every megabyte of your app is a megabyte someone pays for before they can open it. On a prepaid data bundle, which is how most people in Nigeria, Kenya, Ghana and many other markets buy mobile data, a 60 MB download can be the difference between "install now" and "install later, on Wi-Fi", and later often never comes. A small app also installs faster on phones with little free storage, which many low-cost Android phones have.

An Expo app's download is made of three things you control: the JavaScript bundle, the images and fonts it ships, and the native Android code and resources. This tutorial works through all three on a small clinic finder screen. You measure first, so every change has a number attached: Expo Atlas shows what is inside the bundle, du shows the bytes on disk, and a short script turns those numbers into a budget that fails when someone adds weight. Then you change the Android release settings and read the generated files to confirm each one. The release build itself needs the Android SDK and comes last.

Step 1 · Create an app with two typical size problems

Create a TypeScript app from the blank template in a practice folder. The @sdk-58 suffix fixes the template to Expo SDK 58:

Bash
mkdir -p ~/app-size-demo
cd ~/app-size-demo
npx create-expo-app@5.0.0 shrink-demo --template blank-typescript@sdk-58

Add lodash, a utility library many apps pull in for one or two functions, and its TypeScript types:

Bash
cd ~/app-size-demo/shrink-demo
npm install lodash@4.18.1
npm install --save-dev @types/lodash@4.17.27

Next, the photo. Make a folder for original, full-size images and copy a photo from your phone into it as clinic-photo.jpg. Replace the source path with your own file:

Bash
cd ~/app-size-demo/shrink-demo
mkdir -p assets/originals
Bash
cp ~/Downloads/your-photo.jpg ~/app-size-demo/shrink-demo/assets/originals/clinic-photo.jpg

Now write the screen. It shows the photo, a search box and a list of clinics, and it uses lodash's debounce so the list only filters once the user pauses typing. The photo is loaded through a small photos.ts file, so you can change the image later without touching the screen:

Bash
cd ~/app-size-demo/shrink-demo
cat > photos.ts <<'TS'
export const clinicPhoto = require('./assets/originals/clinic-photo.jpg')
TS
cat > App.tsx <<'TSX'
import { StatusBar } from 'expo-status-bar'
import { useMemo, useState } from 'react'
import { Image, StyleSheet, Text, TextInput, View } from 'react-native'
import _ from 'lodash'
import { clinicPhoto } from './photos'

const CLINICS = ['Larkfield Central', 'Larkfield North', 'Riverside', 'Old Town']

export default function App() {
  const [query, setQuery] = useState('')
  const [shown, setShown] = useState(CLINICS)
  const filter = useMemo(
    () =>
      _.debounce((text: string) => {
        setShown(CLINICS.filter((name) => name.toLowerCase().includes(text.toLowerCase())))
      }, 250),
    [],
  )

  return (
    <View style={styles.container}>
      <Image source={clinicPhoto} style={styles.photo} resizeMode="cover" accessibilityIgnoresInvertColors />
      <TextInput
        placeholder="Find a clinic"
        value={query}
        onChangeText={(text) => {
          setQuery(text)
          filter(text)
        }}
        style={styles.input}
      />
      {shown.map((name) => (
        <Text key={name} style={styles.row}>
          {name}
        </Text>
      ))}
      <StatusBar style="auto" />
    </View>
  )
}

const styles = StyleSheet.create({
  container: { flex: 1, backgroundColor: '#fff', padding: 16, paddingTop: 48 },
  photo: { width: '100%', aspectRatio: 4 / 3, borderRadius: 8 },
  input: { borderWidth: 1, borderColor: '#9ba1ac', borderRadius: 8, padding: 12, marginVertical: 16 },
  row: { fontSize: 16, paddingVertical: 8 },
})
TSX

Nothing here is wrong on purpose in an obvious way. import _ from 'lodash' and a photo straight off the camera are what most real apps look like before anyone measures them.

Check it worked

Bash
cd ~/app-size-demo/shrink-demo
node -e "console.log('lodash', require('lodash/package.json').version)"
ls -l assets/originals

The first line is lodash 4.18.1. The listing shows clinic-photo.jpg with a size in the millions of bytes: a modern phone camera writes 3 to 9 MB per photo.

Step 2 · Export the Android bundle with Expo Atlas switched on

Expo Atlas records every module that goes into the bundle while Expo exports it. Install it as a development dependency. The -- passes the flag on to npm:

Bash
cd ~/app-size-demo/shrink-demo
npx expo install expo-atlas -- --save-dev

Export the Android bundle with Atlas on. EXPO_ATLAS=true turns on the recording. --no-bytecode skips compiling the JavaScript to Hermes bytecode: the Expo CLI documents that flag for exactly this job, analysing bundle size, and it makes the numbers easier to compare between runs:

Bash
cd ~/app-size-demo/shrink-demo
rm -rf dist
EXPO_ATLAS=true npx expo export --platform android --no-bytecode

rm -rf dist clears the last export first, so no old file is counted. Expo warns that disabling bytecode is discouraged: that warning is about apps you ship, and this export is only for measuring. The export prints what it wrote, something like:

Text
› Assets (1):
assets/originals/clinic-photo.jpg (8.7MB)

› android bundles (1):
_expo/static/js/android/index-<hash>.js (1.04MB)

Save the sizes in kibibytes, so you can compare later:

Bash
cd ~/app-size-demo/shrink-demo
du -sk dist/_expo/static/js/android dist/assets | tee sizes-before.txt

A normal export, and the release build, compile the same code to Hermes bytecode (.hbc). That file is larger than the minified JavaScript but tracks it closely, so a cut you see here is a cut in the app.

Check it worked

sizes-before.txt has two lines, one for the JavaScript folder (about 1,000 KiB) and one for dist/assets (roughly the size of your photo). Atlas wrote its data next to them:

Bash
cd ~/app-size-demo/shrink-demo
ls -l .expo/atlas.jsonl

The file holds the original and transformed source of every module in the bundle, so treat it like your source code. The template's .gitignore already leaves the .expo folder out of Git.

Step 3 · Find the heaviest packages

Open the file in the Atlas viewer. It starts a local web page and prints the address to open in your browser:

Bash
cd ~/app-size-demo/shrink-demo
npx expo-atlas .expo/atlas.jsonl

The viewer draws the bundle as a treemap: each box is a package or file, sized by how much code it adds. In this app two boxes stand out, react-native itself and lodash. Click lodash and you find one file, lodash.js, larger than most packages in the app. Click it again to see which of your files imported it: App.tsx.

The viewer is the best tool for exploring. For a quick answer in the terminal, or in a CI job, a short script can read the same file. Create it in a scripts folder:

Bash
cd ~/app-size-demo/shrink-demo
mkdir -p scripts
cat > scripts/atlas-top.js <<'JS'
// Lists the packages that add the most code to each bundle in .expo/atlas.jsonl.
// Written for the expo-atlas 0.5 file format: line 1 is a header, each later line is one bundle.
const fs = require('fs')

const file = process.argv[2] || '.expo/atlas.jsonl'
const [header, ...bundles] = fs.readFileSync(file, 'utf8').trim().split('\n').map((line) => JSON.parse(line))
if (header.name !== 'expo-atlas') throw new Error(`${file} is not an Expo Atlas file`)

for (const bundle of bundles) {
  const [platform, , , entry, , , modules] = bundle
  const totals = new Map()
  for (const mod of modules) {
    const name = mod.package || '(your code)'
    totals.set(name, (totals.get(name) || 0) + mod.size)
  }
  const all = [...totals.values()].reduce((a, b) => a + b, 0)
  console.log(`${platform} bundle from ${entry.split('/').pop()}: ${modules.length} modules, ${(all / 1024).toFixed(0)} KiB in total`)
  for (const [name, size] of [...totals].sort((a, b) => b[1] - a[1]).slice(0, 8)) {
    console.log(`  ${(size / 1024).toFixed(1).padStart(8)} KiB  ${name}`)
  }
}
JS
node scripts/atlas-top.js | tee atlas-before.txt

Read the numbers as each package's share of the bundle rather than exact bytes on the phone: what matters is the order. The script reads Atlas's file format as it is in expo-atlas 0.5. If a later version changes the format, the header check is where you find out.

Check it worked

Bash
cd ~/app-size-demo/shrink-demo
grep -E ' lodash$' atlas-before.txt

The line reads something like 71.4 KiB lodash, second only to react-native. One call to debounce brought in the whole library.

Step 4 · Replace the heavy import

import _ from 'lodash' loads lodash.js, the full library in one file. Metro, the bundler Expo uses, cannot drop the parts you do not call from a file like that. Lodash also ships each function as its own module, so import only the one you use. Write the screen again with the narrow import:

Bash
cd ~/app-size-demo/shrink-demo
cat > App.tsx <<'TSX'
import { StatusBar } from 'expo-status-bar'
import { useMemo, useState } from 'react'
import { Image, StyleSheet, Text, TextInput, View } from 'react-native'
import debounce from 'lodash/debounce'
import { clinicPhoto } from './photos'

const CLINICS = ['Larkfield Central', 'Larkfield North', 'Riverside', 'Old Town']

export default function App() {
  const [query, setQuery] = useState('')
  const [shown, setShown] = useState(CLINICS)
  const filter = useMemo(
    () =>
      debounce((text: string) => {
        setShown(CLINICS.filter((name) => name.toLowerCase().includes(text.toLowerCase())))
      }, 250),
    [],
  )

  return (
    <View style={styles.container}>
      <Image source={clinicPhoto} style={styles.photo} resizeMode="cover" accessibilityIgnoresInvertColors />
      <TextInput
        placeholder="Find a clinic"
        value={query}
        onChangeText={(text) => {
          setQuery(text)
          filter(text)
        }}
        style={styles.input}
      />
      {shown.map((name) => (
        <Text key={name} style={styles.row}>
          {name}
        </Text>
      ))}
      <StatusBar style="auto" />
    </View>
  )
}

const styles = StyleSheet.create({
  container: { flex: 1, backgroundColor: '#fff', padding: 16, paddingTop: 48 },
  photo: { width: '100%', aspectRatio: 4 / 3, borderRadius: 8 },
  input: { borderWidth: 1, borderColor: '#9ba1ac', borderRadius: 8, padding: 12, marginVertical: 16 },
  row: { fontSize: 16, paddingVertical: 8 },
})
TSX

The same habit applies to other large libraries: import from the path of the one function or icon you need, or replace the library with a few lines of your own when you use one small piece of it. Date libraries with every locale built in, icon sets imported as a whole, and SDKs that bundle features you never call are the usual suspects in Atlas.

Export and measure again:

Bash
cd ~/app-size-demo/shrink-demo
rm -rf dist
EXPO_ATLAS=true npx expo export --platform android --no-bytecode

Check it worked

Bash
cd ~/app-size-demo/shrink-demo
node scripts/atlas-top.js | tee atlas-after.txt
if grep -qE ' lodash$' atlas-after.txt; then echo 'lodash still in the top eight'; false; fi
cat sizes-before.txt
du -sk dist/_expo/static/js/android

The JavaScript folder is about 70 KiB smaller than the first line of sizes-before.txt (something like 944 against 1012), and lodash has dropped out of the top eight packages in the script's output. If it has not, the if line prints lodash still in the top eight and fails: look for another file that still imports the whole library. That is roughly 7 per cent of this bundle, from changing one line, and on a real app with several such imports the savings add up.

Step 5 · Right-size the photo and check your fonts

The photo is the largest single file in the app. A phone screen is about 1,080 pixels wide, so a 4,032-pixel camera photo carries roughly 14 times more pixels than any screen can show. Resize it and convert it to WebP, which Android and iOS both display and which stores photos in far fewer bytes than JPEG at the same visible quality.

Install sharp, an image library for Node, as a development dependency. It runs on your computer at build time and never ships in the app:

Bash
cd ~/app-size-demo/shrink-demo
npm install --save-dev sharp@0.35.5

Write a script that turns every JPEG or PNG in assets/originals into a resized WebP in assets/images:

Bash
cd ~/app-size-demo/shrink-demo
cat > scripts/resize-images.js <<'JS'
// Turns each large photo in assets/originals into a WebP that fits a phone screen.
const fs = require('fs')
const path = require('path')
const sharp = require('sharp')

const SRC = 'assets/originals'
const OUT = 'assets/images'
const MAX_WIDTH = 1080 // pixels: the width of a typical phone screen
const QUALITY = 70 // WebP quality, 0 to 100

fs.mkdirSync(OUT, { recursive: true })

async function main() {
  for (const file of fs.readdirSync(SRC).filter((f) => /\.(jpe?g|png)$/i.test(f))) {
    const out = path.join(OUT, file.replace(/\.(jpe?g|png)$/i, '.webp'))
    const info = await sharp(path.join(SRC, file))
      .resize({ width: MAX_WIDTH, withoutEnlargement: true })
      .webp({ quality: QUALITY })
      .toFile(out)
    const before = fs.statSync(path.join(SRC, file)).size
    console.log(`${file}: ${(before / 1024).toFixed(0)} KiB -> ${out}: ${(info.size / 1024).toFixed(0)} KiB (${info.width}x${info.height})`)
  }
}

main().catch((err) => {
  console.error(err)
  process.exitCode = 1
})
JS
node scripts/resize-images.js

It prints one line per image, something like clinic-photo.jpg: 8471 KiB -> assets/images/clinic-photo.webp: 120 KiB (1080x810). The exact size depends on the photo: busy scenes compress less than plain walls. Open the WebP on your computer and compare it with the original at phone size. If you see blocky edges, raise QUALITY to 80 and run the script again.

Point the app at the new file. Only photos.ts changes:

Bash
cd ~/app-size-demo/shrink-demo
cat > photos.ts <<'TS'
export const clinicPhoto = require('./assets/images/clinic-photo.webp')
TS

Keep assets/originals in your repository if you like. Metro only copies an asset into the app when code requires it, so the originals no longer ship.

Fonts work the same way. A font family loaded with expo-font or useFonts ships every file you list, and each weight is typically 50 to 300 KB. Load only the weights your designs use (often regular and bold), and prefer the system font for body text when the brand allows it. If your app shows Yoruba, Hausa, Amharic or other text with accented letters or a non-Latin script, check the font covers those characters before you trim it to a subset, or the text falls back to a different font mid-sentence.

Check it worked

Bash
cd ~/app-size-demo/shrink-demo
rm -rf dist
npx expo export --platform android --no-bytecode
ls dist/assets
du -sk dist/_expo/static/js/android dist/assets | tee sizes-after.txt

dist/assets now holds one file of about 100 KiB instead of several megabytes, and the export's asset list names assets/images/clinic-photo.webp. Together with the import change, the parts of the download that JavaScript and assets control have gone from around 9.5 MB to around 1 MB.

Step 6 · Set a size budget that fails the build

Sizes creep back. One new dependency or one unresized image undoes this work, and nobody notices until a user complains. A budget turns the numbers into a check that fails. Write the limits in a file, a little above today's sizes so normal work has room:

Bash
cd ~/app-size-demo/shrink-demo
cat > size-budget.json <<'JSON'
{
  "androidJsKiB": 1000,
  "assetsKiB": 300
}
JSON
cat > scripts/check-size-budget.js <<'JS'
// Fails when the exported Android bundle or its assets grow past size-budget.json.
const fs = require('fs')
const path = require('path')

function folderKiB(dir) {
  if (!fs.existsSync(dir)) return 0
  let bytes = 0
  for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
    const full = path.join(dir, entry.name)
    bytes += entry.isDirectory() ? folderKiB(full) * 1024 : fs.statSync(full).size
  }
  return bytes / 1024
}

const budget = JSON.parse(fs.readFileSync('size-budget.json', 'utf8'))
const checks = [
  ['Android JavaScript', folderKiB('dist/_expo/static/js/android'), budget.androidJsKiB],
  ['Assets', folderKiB('dist/assets'), budget.assetsKiB],
]

let over = false
for (const [label, size, limit] of checks) {
  const ok = size <= limit
  if (!ok) over = true
  console.log(`${ok ? 'OK  ' : 'OVER'} ${label}: ${size.toFixed(0)} KiB of ${limit} KiB`)
}
if (over) {
  console.error('Size budget exceeded. Run EXPO_ATLAS=true npx expo export and open Atlas to see what grew.')
  process.exitCode = 1
}
JS
node scripts/check-size-budget.js

Run it after npx expo export in CI, the same way you run tests. When it fails, the message tells the next person where to look. Raise a limit only on purpose, in a reviewed change to size-budget.json, never to make a failing build pass.

Check it worked

The script prints two lines starting with OK, for example OK Android JavaScript: 944 KiB of 1000 KiB. To see it fail, set assetsKiB to 50 in size-budget.json and run node scripts/check-size-budget.js again: the assets line starts with OVER and the command exits with an error. Set the value back to 300 afterwards.

Step 7 · Add resource shrinking to the Android release build

The rest of the download is native: Java and Kotlin code from React Native and every library, plus Android resources such as layouts, drawables and translated strings. Two release build settings shrink it:

  • R8 removes unused code and shortens class names (enableMinifyInReleaseBuilds). SDK 58 apps already run it: the template's android/gradle.properties sets android.enableMinifyInReleaseBuilds=true.
  • Resource shrinking then removes resources nothing refers to. It only works together with R8 (enableShrinkResourcesInReleaseBuilds), and it is off by default.

So this step adds resource shrinking, turns off PNG crunching (on by default, see below) and sets R8 explicitly, so a later change cannot switch it off without anyone noticing.

Both are options of expo-build-properties, a config plugin that writes Gradle settings when Expo generates the android folder. If config plugins and prebuild are new to you, the config plugins and prebuild tutorial explains them. Install the plugin:

Bash
cd ~/app-size-demo/shrink-demo
npx expo install expo-build-properties

The install command also adds a bare "expo-build-properties" entry to the plugins list in app.json.

Add an app.config.js next to app.json. Expo reads app.json first and passes it in as config, so this file only holds what you change. A plugins list here replaces the one in app.json, so the file copies over every plugin already there (in your own app that may include expo-router, expo-font or expo-splash-screen), leaves out the bare expo-build-properties entry, and adds it back with options. It also sets the Android application ID, which prebuild needs:

Bash
cd ~/app-size-demo/shrink-demo
cat > app.config.js <<'JS'
// Replace com.example.shrinkdemo with your own reverse-domain ID.
const APP_ID = 'com.example.shrinkdemo'

// Keep the plugins from app.json, except the bare entry this file replaces.
const isBuildProperties = (p) => (Array.isArray(p) ? p[0] : p) === 'expo-build-properties'

module.exports = ({ config }) => ({
  ...config,
  android: { ...config.android, package: APP_ID },
  plugins: [
    ...(config.plugins ?? []).filter((p) => !isBuildProperties(p)),
    [
      'expo-build-properties',
      {
        android: {
          enableMinifyInReleaseBuilds: true,
          enableShrinkResourcesInReleaseBuilds: true,
          enablePngCrunchInReleaseBuilds: false,
        },
      },
    ],
  ],
})
JS

enablePngCrunchInReleaseBuilds: false stops Gradle recompressing PNGs. The Expo docs note that crunching can make already-optimised PNGs larger, so switch it off once you compress images yourself.

Two settings are better left alone. buildArchs can drop processor types (ABIs) from the build, but an app bundle already gives each phone only the native code for its own processor, so removing ABIs saves your users nothing and can lock out some devices. enableBundleCompression makes the APK file smaller, but Google Play already compresses downloads, and the docs warn it can slow app startup, which hurts most on the low-end phones you are optimising for.

Generate the android folder. --clean deletes any earlier copy first, and --no-install leaves npm alone. Because you have just added App.tsx, photos.ts and the scripts, prebuild warns that the Git working tree has uncommitted changes and asks whether to continue: answer yes, or commit your work first:

Bash
cd ~/app-size-demo/shrink-demo
npx expo prebuild --clean --no-install --platform android

R8 can remove classes that a library only reaches through reflection. If a release build crashes where the debug build works, that is the first thing to check: the library's docs usually give a keep rule, which you add with the plugin's extraProguardRules option.

Check it worked

Bash
cd ~/app-size-demo/shrink-demo
grep -E '^android\.(enableMinifyInReleaseBuilds|enableShrinkResourcesInReleaseBuilds|enablePngCrunchInReleaseBuilds)=' android/gradle.properties

The output has three lines: android.enablePngCrunchInReleaseBuilds=false, android.enableMinifyInReleaseBuilds=true and android.enableShrinkResourcesInReleaseBuilds=true. The template's android/app/build.gradle reads these properties in its release block.

Step 8 · Drop languages and permissions you do not use

Android libraries such as AndroidX ship their built-in strings (button labels, error messages) in dozens of languages. Resource shrinking keeps them all, because they are used, just not by you. Android's resourceConfigurations setting keeps only the languages you list. For an app bundle on Google Play this saves less, because each phone already downloads only its own languages. It matters more for APKs you share directly or host on your own site, which many apps in Africa offer for people who cannot reach the Play Store or want to pass the app on by Bluetooth or file sharing.

expo-build-properties has no option for it, so write a small config plugin that adds the line to android/app/build.gradle:

Bash
cd ~/app-size-demo/shrink-demo
mkdir -p plugins
cat > plugins/with-app-languages.js <<'JS'
// Keeps only the listed languages' strings from Android libraries in release builds.
const { withAppBuildGradle } = require('expo/config-plugins')

const MARKER = '// with-app-languages'

module.exports = function withAppLanguages(config, { languages = ['en'] } = {}) {
  if (!Array.isArray(languages) || languages.length === 0) {
    throw new Error('with-app-languages: pass at least one language code, for example ["en"]')
  }
  return withAppBuildGradle(config, (cfg) => {
    if (cfg.modResults.language !== 'groovy') {
      throw new Error('with-app-languages: expected android/app/build.gradle written in Groovy')
    }
    if (!cfg.modResults.contents.includes(MARKER)) {
      const list = languages.map((code) => `"${code}"`).join(', ')
      cfg.modResults.contents = cfg.modResults.contents.replace(
        /defaultConfig\s*\{/,
        (match) => `${match}\n        resourceConfigurations += [${list}] ${MARKER}`,
      )
    }
    return cfg
  })
}
JS

The marker comment stops the line being added twice if prebuild runs without --clean. List every language your app's own text is translated into. Leaving one out means a French or Swahili user sees system strings in English even though your screens are in their language.

Permissions do not weigh much, but each one appears on the store listing and some trigger warnings that put people off installing. The SDK 58 template adds READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE, which this app never uses. android.blockedPermissions removes them from the final manifest, including when a library asks for them. Replace app.config.js with the complete version:

Bash
cd ~/app-size-demo/shrink-demo
cat > app.config.js <<'JS'
// Replace com.example.shrinkdemo with your own reverse-domain ID.
const APP_ID = 'com.example.shrinkdemo'

// Keep the plugins from app.json, except the bare entry this file replaces.
const isBuildProperties = (p) => (Array.isArray(p) ? p[0] : p) === 'expo-build-properties'

module.exports = ({ config }) => ({
  ...config,
  android: {
    ...config.android,
    package: APP_ID,
    blockedPermissions: [
      'android.permission.READ_EXTERNAL_STORAGE',
      'android.permission.WRITE_EXTERNAL_STORAGE',
    ],
  },
  plugins: [
    ...(config.plugins ?? []).filter((p) => !isBuildProperties(p)),
    [
      'expo-build-properties',
      {
        android: {
          enableMinifyInReleaseBuilds: true,
          enableShrinkResourcesInReleaseBuilds: true,
          enablePngCrunchInReleaseBuilds: false,
        },
      },
    ],
    ['./plugins/with-app-languages', { languages: ['en', 'fr', 'sw'] }],
  ],
})
JS
npx expo prebuild --clean --no-install --platform android

Block a permission only when you know the app does not need it. If a library depends on one you block, that feature fails at runtime, so test the release build after changing this list.

Check it worked

Bash
cd ~/app-size-demo/shrink-demo
grep 'with-app-languages' android/app/build.gradle
grep 'STORAGE' android/app/src/main/AndroidManifest.xml

The first line reads resourceConfigurations += ["en", "fr", "sw"] // with-app-languages, inside defaultConfig. The two storage permissions now carry tools:node="remove", which tells Android's manifest merger to drop them, whichever library asked for them.

Step 9 · Build an App Bundle and read its real download size

Everything so far you can check without Android tools. The final numbers need a release build. Upload an Android App Bundle (.aab) to Google Play, not a single APK: Play splits the bundle so each phone downloads only the native code for its processor, the images for its screen density and the strings for its languages.

With the Android SDK and a JDK installed, build the bundle locally from the generated folder:

Bash
cd ~/app-size-demo/shrink-demo/android
./gradlew bundleRelease

The bundle lands in android/app/build/outputs/bundle/release/app-release.aab. Without a release signing key it is signed with the debug key, which is fine for measuring but cannot be uploaded. If you build with EAS instead, eas build --platform android --profile production produces an .aab by default.

To estimate what phones will download, use Google's bundletool (download it from its GitHub releases page). It turns the bundle into the set of APKs Play would serve and reports their compressed sizes:

Bash
cd ~/app-size-demo/shrink-demo
java -jar bundletool.jar build-apks --bundle=android/app/build/outputs/bundle/release/app-release.aab --output=app.apks
java -jar bundletool.jar get-size total --apks=app.apks --dimensions=ABI,SCREEN_DENSITY

The output is a table of minimum and maximum download sizes for each processor and screen density. To see what resource shrinking and the language list save for your app, build once with enableShrinkResourcesInReleaseBuilds: false and without the with-app-languages plugin (run prebuild with --clean and build again), then compare. Leave R8 on for that comparison: it is the SDK 58 default.

After a production release, Google Play Console shows an app size report under Android vitals, with the download size per release and a breakdown by component. Download size is what users pay for in data. Install size, the space on the phone, is larger because the download is compressed.

Check it worked

get-size total prints a row for arm64-v8a, the processor in nearly every Android phone sold in recent years, and its maximum download size is the number to quote to your team. Record it next to sizes-after.txt, and watch the app size report in Play Console after each release for growth you did not plan.

Remove the practice folder when you are finished:

Bash
rm -rf ~/app-size-demo

Next steps

Need this done for you?

Padding does this work for growing companies, from the first diagnosis to a system that keeps working.

Platform Engineering

Get new tutorials

New tutorials, about twice a month.