44
kyobashi.dex #1 Multiple APK for density

Multiple apk for Density

  • Upload
    tazake

  • View
    1.448

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Multiple apk for Density

k y o b a s h i . d e x # 1

M u l t i p l e A P K f o r d e n s i t y

Page 2: Multiple apk for Density

A b o u t m e

Page 3: Multiple apk for Density

A b o u t m e

• Kenji Tazawa

• Android Engineer

• Recruit Marketing Partners Co.,Ltd

Page 4: Multiple apk for Density

M u l t i p l e A P K

Page 5: Multiple apk for Density

M u l t i p l e A P K

– A n d r o i d D e v e l o p e r s : M u l t i p l e A P K S u p p o r t

“a single APK is unable to support all device configurations, because alternative resources make the APK file too big (greater than 50MB) or other technical

challenges prevent a single APK from working on all devices.”

Page 6: Multiple apk for Density

S u p p o r t e d f i l t e r s

• Support different OpenGL texture compression formats with each APK.

• Support different screen sizes and densities with each APK.

• Support different device feature sets with each APK.

• Support different platform versions with each APK.

• Support different CPU architectures with each APK (such as for ARM, x86, and MIPS, when your app uses the Android NDK).

Page 7: Multiple apk for Density

S u p p o r t e d f i l t e r s

• Support different OpenGL texture compression formats with each APK.

• Support different screen sizes and densities with each APK.

• Support different device feature sets with each APK.

• Support different platform versions with each APK.

• Support different CPU architectures with each APK (such as for ARM, x86, and MIPS, when your app uses the Android NDK).

Page 8: Multiple apk for Density

H o w t o

Density Splits

Page 9: Multiple apk for Density

H o w t o

android {

splits { density { enable true exclude "mdpi", "tvdpi", "ldpi" compatibleScreens "small", "normal", "large", "xlarge" } } }

Density Splits

Page 10: Multiple apk for Density

H o w t o

VersionCode

Page 11: Multiple apk for Density

H o w t o

project.ext.versionCodesDensity = [all:0, hdpi: 1, xhdpi: 2, xxhdpi: 3, xxxhdpi: 4]

android.applicationVariants.all { variant ->

// assign different version code for each output

variant.outputs.each { output -> def density = output.getFilter(com.android.build.OutputFile.DENSITY)

output.versionCodeOverride = project.ext.versionCodesDensity.get(density, 0) * 100000 + android.defaultConfig.versionCode } }

VersionCode

Page 12: Multiple apk for Density

H o w t o

Page 13: Multiple apk for Density

H o w t o

U p l o a d

Page 14: Multiple apk for Density

H o w t o

Page 15: Multiple apk for Density

H o w t o

android {

splits { density { enable true exclude "mdpi", "tvdpi", "ldpi" compatibleScreens "small", "normal", "large", "xlarge" } } }

Density Splits

Page 16: Multiple apk for Density

H o w t o

android {

splits { density { enable true exclude "mdpi", "tvdpi", "ldpi" compatibleScreens "small", "normal", "large", "xlarge" } } }

Density Splits

Page 17: Multiple apk for Density

H o w t o

android {

splits { density { enable true exclude "mdpi", "tvdpi", "ldpi" compatibleScreens "small", "normal", "large", "xlarge" } } }

This will inject a matching <compatible-screens><screen ...> node in the manifest.

Density Splits

Page 18: Multiple apk for Density

H o w t o

Page 19: Multiple apk for Density

H o w t o

U p l o a d

Page 20: Multiple apk for Density

H o w t o

Page 21: Multiple apk for Density

H o w t o

<?xml version="1.0" encoding="utf-8" standalone="no"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package=“com.tazawa.density.sample" platformBuildVersionCode="22" platformBuildVersionName="5.1.1-1819727"> <compatible-screens> <screen android:screenDensity="hdpi" android:screenSize="small"/> <screen android:screenDensity="hdpi" android:screenSize="large"/> <screen android:screenDensity="hdpi" android:screenSize="xlarge"/> <screen android:screenDensity="hdpi" android:screenSize="normal"/> </compatible-screens>

hdpi - AndroidManifest.xml

Page 22: Multiple apk for Density

H o w t o

hdpi - drawable

Page 23: Multiple apk for Density

H o w t o

<?xml version="1.0" encoding="utf-8" standalone="no"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.tazawa.density.sample" platformBuildVersionCode="22" platformBuildVersionName="5.1.1-1819727"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"

universal - AndroidManifest.xml

Page 24: Multiple apk for Density

H o w t o

universal - drawable

Page 25: Multiple apk for Density

I m p r e s s i o n s

Page 26: Multiple apk for Density

I m p r e s s i o n s

画像リソースという観点から見ると、現時点で最も容量をとるのはxxxhdpiのリソース群

Page 27: Multiple apk for Density

I m p r e s s i o n s

将来的に

Page 28: Multiple apk for Density

I m p r e s s i o n s

将来的に

xxxxhdpi

Page 29: Multiple apk for Density

I m p r e s s i o n s

将来的に

xxxxhdpi xxxxxhdpi

Page 30: Multiple apk for Density

I m p r e s s i o n s

将来的に

xxxxhdpi xxxxxhdpi xxxxxhdpi

Page 31: Multiple apk for Density

I m p r e s s i o n s

将来的に

xxxxhdpi xxxxxhdpi xxxxxhdpi xxxxxxxhdpi

Page 32: Multiple apk for Density

I m p r e s s i o n s

将来的に

xxxxhdpi xxxxxhdpi xxxxxhdpi xxxxxxxhdpi xxxxxxhdpi

Page 33: Multiple apk for Density

I m p r e s s i o n s

将来的に

xxxxhdpi xxxxxhdpi xxxxxhdpi xxxxxxxhdpi xxxxxxhdpi xxxxxxxxxhdpi

Page 34: Multiple apk for Density

I m p r e s s i o n s

• 画像を多用していると、将来的に1density分のapk

でも50Mに到達することも起こりえる

• compatibleScreensを使用しているため、Densityの対応もれに気をつける必要がある(tvdpi,mdpi)

• apkの種類が増えることでQAコストかさむ

Page 35: Multiple apk for Density

I m p r e s s i o n s

• 画像を多用していると、将来的に1density分のapk

でも50Mに到達することも起こりえる

• compatibleScreensを使用しているため、Densityの対応もれに気をつける必要がある(tvdpi,mdpi)

• apkの種類が増えることでQAコストかさむ

Page 36: Multiple apk for Density

I m p r e s s i o n s

• 画像を多用していると、将来的に1density分のapk

でも50Mに到達することも起こりえる

• compatibleScreensを使用しているため、Densityの対応もれに気をつける必要がある(tvdpi,mdpi)

• apkの種類が増えることでQAコストかさむ

Page 37: Multiple apk for Density

S u m m a r y

Page 38: Multiple apk for Density

S u m m a r y

• DensityごとでのAPK作成は比較的容易

• 画像リソースによる肥大化対応のために使用するのは控えたい

• そもそも、画像リソースは入れすぎない

• そもそも、画像でapkサイズをひっぱくさせない

• シンプルに運用したいから極力使いたくない

Page 39: Multiple apk for Density

S u m m a r y

• DensityごとでのAPK作成は比較的容易

• 画像リソースによる肥大化対応のために使用するのは控えたい

• そもそも、画像リソースは入れすぎない

• そもそも、画像でapkサイズをひっぱくさせない

• シンプルに運用したいから極力使いたくない

Page 40: Multiple apk for Density

S u m m a r y

• DensityごとでのAPK作成は比較的容易

• 画像リソースによる肥大化対応のために使用するのは控えたい

• そもそも、画像リソースは入れすぎない

• そもそも、画像でapkサイズをひっぱくさせない

• シンプルに運用したいから極力使いたくない

Page 41: Multiple apk for Density

S u m m a r y

• DensityごとでのAPK作成は比較的容易

• 画像リソースによる肥大化対応のために使用するのは控えたい

• そもそも、画像リソースは入れすぎない

• そもそも、画像でapkサイズをひっぱくさせない

• シンプルに運用したいから極力使いたくない

Page 42: Multiple apk for Density

S u m m a r y

• DensityごとでのAPK作成は比較的容易

• 画像リソースによる肥大化対応のために使用するのは控えたい

• そもそも、画像リソースは入れすぎない

• そもそも、画像でapkサイズをひっぱくさせない

• シンプルに運用したいから極力使いたくない

Page 43: Multiple apk for Density

M u l t i p l e A P K

– A n d r o i d D e v e l o p e r s : M u l t i p l e A P K S u p p o r t

“we encourage you to develop and publish a single APK”

Page 44: Multiple apk for Density

t h a n k s