Skip to content

Commit

Permalink
chore: enable building multiple apks per abi
Browse files Browse the repository at this point in the history
Enable multiple apks per abi ensures smaller apk,
and users can choose best fit by themself.

tree -h app/build/outputs/apk/
app/build/outputs/apk/
└── [ 256]  release
    ├── [1.5K]  output-metadata.json
    ├── [4.9M]  trime-3.2.4-arm64-v8a-release.apk
    ├── [4.8M]  trime-3.2.4-armeabi-v7a-release.apk
    ├── [9.2M]  trime-3.2.4-universal-release.apk
    ├── [5.1M]  trime-3.2.4-x86-release.apk
    └── [5.1M]  trime-3.2.4-x86_64-release.apk

1 directory, 6 files

https://developer.android.com/studio/build/configure-apk-splits.html#configure-density-split
  • Loading branch information
Bambooin committed Nov 3, 2021
1 parent e0950e9 commit 7cfe3ce
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,23 @@ android {
}
}

flavorDimensions 'cpuArch'
productFlavors {
arm {
dimension 'cpuArch'
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a'
}
}
x86 {
dimension 'cpuArch'
ndk {
abiFilters 'x86_64', 'x86'
}
}
universal {
dimension 'cpuArch'
// include all default ABIs. with NDK-r16, it is:
// armeabi-v7a, arm64-v8a, x86, x86_64
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true

// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86 and x86_64.

// Resets the list of ABIs that Gradle should create APKs for to none.
reset()

// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"

// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk true
}
}
}
Expand Down

0 comments on commit 7cfe3ce

Please sign in to comment.