expo-ruler is an Expo config plugin that configures Spotify Ruler for Android projects generated with npx expo prebuild.
Spotify Ruler is a Gradle plugin for analyzing Android app size.
npx expo install expo-ruler
Add the plugin to app.json:
{
"expo": {
"plugins": ["expo-ruler"]
}
}Run the analyze<VariantName>Bundle task that Ruler adds for each app variant:
cd android && ./gradlew app:analyzeReleaseBundle
The HTML (report.html) and JSON (report.json) reports are written to android/app/build/reports/ruler/release/.
If your project defines custom build variants, list the available Ruler tasks with:
cd android && ./gradlew tasks --group="Ruler"
All options are optional. The defaults describe a modern high-density ARM64 device, override to match your users.
| Option | Type | Default | Description |
|---|---|---|---|
abi |
string |
"arm64-v8a" |
Target ABI. One of "arm64-v8a", "armeabi-v7a", "x86", "x86_64". |
locale |
string |
"en" |
Target locale. |
screenDensity |
number |
480 |
Target screen density in dpi. |
sdkVersion |
number |
36 |
Target Android SDK version (API level). |
rulerVersion |
string |
"2.0.0-beta-3" |
Spotify Ruler Gradle plugin version to install. |
Spotify Ruler requires Gradle 8+, Android Gradle Plugin 8+, and JDK 17, which ships with Expo SDK 50 and newer.