Build your Android app
Faster and Smaller than ever
Jirawat Karanwittayakarn

Technology Evangelist, LINE THAILAND
Agenda • Overview of LINE MAN
• Tips for smaller app builds
• Techniques for faster app builds
AN ON-DEMAND ASSISTANT APP
WITH PROFESSIONAL SERVICES
YOUR DAILY LIFE ASSISTANT
FOOD

DELIVERY
CONVENIENCE

GOODS DELIVERY
MESSENGER

SERVICE
POSTAL / PARCEL

SERVICE
TAXI
JOINED DEVELOPER BUILD CLINIC
● Developer Build Clinic is one on one consulting
in build performance improvement provided by
Android Studio Team

● Have been part of it since 2016

● Throughout the years I have gathered tips and
advises from the team
! ACTUAL RESULTS MAY VARY
TIPS FOR BUILDING
LINE MAN DRIVER APP SMALLER
CURRENT APP SIZE
Quick Recommendation: Use APK Analyzer
Tip 1: Remove
Unused Resources
Tip 2: Add just
Dependencies Needed
$ ./gradlew app:dependencies
android {
splits {
density {
enable true
// Specifies a list of screen densities Gradle should not create multiple APKs for.
exclude 'ldpi', 'mdpi'
// Specifies a list of compatible screen size settings for the manifest.
compatibleScreens 'small', 'normal', 'large', 'xlarge'
}
}
}
Tip 3: Build Multiple APKs for Screen Densities
android {
splits {
abi {
enable true
reset() // By default all ABIs are included, so use reset() and specify that you only want
// Specifies a list of ABIs that Gradle should create APKs for.
include 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a'
universalApk false // Specifies that we don’t want to also generate a universal APK that includes all ABIs.
}
}
}
Tip 4: Build Multiple APKs for ABIs
android {
defaultConfig {
...
ndk {
abiFilters 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a'
// armeabi, mips and mips64 has removed since NDK r17
}
}
}
Tip 5: Build an APK with Specific ABIs
android {
defaultConfig {
resConfigs 'en', 'th'
...
}
}
Tip 6: Remove Unused Alternative Resources
android {
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
Tip 7: Shrink Unused Code and Resources
Tip 8: Use
Shape Drawable
• Support rectangle, oval, line and
ring shapes
• Support gradient, rounded corner
and outline stroke effects.
Tip 9: Use WebP
• Up to 30% smaller than PNGs
• Opaque - API level 15+
• With transparency - API level 18+
Build your Android app Faster and Smaller than ever
Tip 10: Use VectorDrawable
• Smaller than Bitmaps
• Resize for different screen densities
without loss of image quality
• API level 21 and higher
• API level <= 20 (use the Support Library)
CUMULATIVE IMPROVEMENT
9MB 7.9MB
TECHNIQUES FOR
BUILDING
LINE MAN DRIVER APP
FASTER
Knowledge from Developer Build Clinic by Android Studio Team 

and “Speeding Up Your Android Gradle Builds” (Google I/O ’17)
CURRENT BUILDING SPEED
~ 3 mins
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.0'
+ classpath 'com.android.tools.build:gradle:3.2.1'
}
...
}
Technique 1: Use Latest Android Plugin
productFlavors {
development {
minSdkVersion 21
...
}
}
Technique 2: Avoid Legacy Multidex
buildTypes {
...
debug {
splits.abi.enable = false
splits.density.enable = false
}
}
Technique 3: Disable Multi APK
productFlavors {
dev {
resConfigs('en', 'xhdpi')
...
}
}
Technique 4: Include Minimal Resources
buildTypes {
...
debug {
aaptOptions.cruncherEnabled = false
...
}
}
Technique 5: Disable PNG Crunching
Technique 6: Use Instant Run
buildTypes {
debug {
ext.alwaysUpdateBuildId = false
...
}
}
Technique 7: Disable Updating Build ID
android {
dependencies {
implementation 'com.android.support:appcompat-v7:+'
...
}
}
Technique 8: Don’t Use Dynamic Versions
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:
+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.caching=true
android.enableBuildScriptClasspathCheck=false
Technique 9: Config gradle.properties
Available in Android Studio 3.3
Technique 10: Use R8 new code shrinker
BUILDING SPEED AFTER
~ 1 mins
CUMULATIVE IMPROVEMENT
3.02m 1m
3X Faster
ONE MORE THING…
What’s new in Android Studio 3.2
Android App Bundle
THANK YOU

More Related Content

PPTX
Nitrodroid 2013 | Building your first Android App on PhoneGap
PDF
Mobile Landing Pages Talk
PDF
Flutter study jam - Begineers (1st level)
PPSX
Progressive Web App
PPTX
Progressive Web Apps
ODP
What is PhoneGap?
PDF
Appportunity
PPTX
Олексій Бойко, «Використання SVG для відображення складної графіки в браузері...
Nitrodroid 2013 | Building your first Android App on PhoneGap
Mobile Landing Pages Talk
Flutter study jam - Begineers (1st level)
Progressive Web App
Progressive Web Apps
What is PhoneGap?
Appportunity
Олексій Бойко, «Використання SVG для відображення складної графіки в браузері...

Similar to Build your Android app Faster and Smaller than ever (20)

PPTX
Decrease build time and application size
PDF
Optimize APK size
PDF
The Road To Single Dex (Gradle Summit 2017)
PDF
The Road To Single Dex (GDG San Francisco Meetup)
PDF
Generating efficient APK by Reducing Size and Improving Performance
PDF
Make Your Build Great Again (DroidConSF 2017)
PDF
Michal Havryluk: How To Speed Up Android Gradle Builds
PDF
Developing for Android TV and the Nexus player - Mihai Risca & Alexander Wegg...
PPTX
Сергей Жук "Android Performance Tips & Tricks"
PPTX
Android Performance Tips & Tricks
PPTX
[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV
PPTX
How to deal with Fragmentation on Android
PDF
Sidiq Permana - Building For The Next Billion Users
PPTX
Faster Builds and Emulators (Xamarin.Android)
PDF
divide and qonquer
PDF
14 Tips On How To Improve Android App Performance
PDF
7 Ways to improve your gradle build
PDF
Intro to Gradle + How to get up to speed
PDF
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
PPTX
Presentation - Android App Development - Mr. Samrakchan
Decrease build time and application size
Optimize APK size
The Road To Single Dex (Gradle Summit 2017)
The Road To Single Dex (GDG San Francisco Meetup)
Generating efficient APK by Reducing Size and Improving Performance
Make Your Build Great Again (DroidConSF 2017)
Michal Havryluk: How To Speed Up Android Gradle Builds
Developing for Android TV and the Nexus player - Mihai Risca & Alexander Wegg...
Сергей Жук "Android Performance Tips & Tricks"
Android Performance Tips & Tricks
[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV
How to deal with Fragmentation on Android
Sidiq Permana - Building For The Next Billion Users
Faster Builds and Emulators (Xamarin.Android)
divide and qonquer
14 Tips On How To Improve Android App Performance
7 Ways to improve your gradle build
Intro to Gradle + How to get up to speed
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Presentation - Android App Development - Mr. Samrakchan
Ad

More from LINE Corporation (20)

PDF
JJUG CCC 2018 Fall 懇親会LT
PDF
Reduce dependency on Rx with Kotlin Coroutines
PDF
Kotlin/NativeでAndroidのNativeメソッドを実装してみた
PDF
Use Kotlin scripts and Clova SDK to build your Clova extension
PDF
The Magic of LINE 購物 Testing
PPTX
GA Test Automation
PDF
UI Automation Test with JUnit5
PDF
Feature Detection for UI Testing
PDF
LINE 新星計劃介紹與新創團隊分享
PDF
​LINE 技術合作夥伴與應用分享
PDF
LINE 開發者社群經營與技術推廣
PDF
日本開發者大會短講分享
PDF
LINE Chatbot - 活動報名報到設計分享
PDF
在 LINE 私有雲中使用 Managed Kubernetes
PDF
LINE TODAY高效率的敏捷測試開發技巧
PDF
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
PDF
LINE Things - LINE IoT平台新技術分享
PDF
LINE Pay - 一卡通支付新體驗
PDF
LINE Platform API Update - 打造一個更好的Chatbot服務
PDF
Keynote - ​LINE 的技術策略佈局與跨國產品開發
JJUG CCC 2018 Fall 懇親会LT
Reduce dependency on Rx with Kotlin Coroutines
Kotlin/NativeでAndroidのNativeメソッドを実装してみた
Use Kotlin scripts and Clova SDK to build your Clova extension
The Magic of LINE 購物 Testing
GA Test Automation
UI Automation Test with JUnit5
Feature Detection for UI Testing
LINE 新星計劃介紹與新創團隊分享
​LINE 技術合作夥伴與應用分享
LINE 開發者社群經營與技術推廣
日本開發者大會短講分享
LINE Chatbot - 活動報名報到設計分享
在 LINE 私有雲中使用 Managed Kubernetes
LINE TODAY高效率的敏捷測試開發技巧
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
LINE Things - LINE IoT平台新技術分享
LINE Pay - 一卡通支付新體驗
LINE Platform API Update - 打造一個更好的Chatbot服務
Keynote - ​LINE 的技術策略佈局與跨國產品開發
Ad

Recently uploaded (20)

PDF
Streamline Vulnerability Management From Minimal Images to SBOMs
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
PDF
A symptom-driven medical diagnosis support model based on machine learning te...
PDF
Build Real-Time ML Apps with Python, Feast & NoSQL
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PDF
CEH Module 2 Footprinting CEH V13, concepts
PPTX
Blending method and technology for hydrogen.pptx
PDF
substrate PowerPoint Presentation basic one
PDF
Launch a Bumble-Style App with AI Features in 2025.pdf
PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
PDF
Human Computer Interaction Miterm Lesson
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
Altius execution marketplace concept.pdf
Streamline Vulnerability Management From Minimal Images to SBOMs
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
Lung cancer patients survival prediction using outlier detection and optimize...
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
A symptom-driven medical diagnosis support model based on machine learning te...
Build Real-Time ML Apps with Python, Feast & NoSQL
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
CEH Module 2 Footprinting CEH V13, concepts
Blending method and technology for hydrogen.pptx
substrate PowerPoint Presentation basic one
Launch a Bumble-Style App with AI Features in 2025.pdf
Early detection and classification of bone marrow changes in lumbar vertebrae...
Human Computer Interaction Miterm Lesson
Introduction to MCP and A2A Protocols: Enabling Agent Communication
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Altius execution marketplace concept.pdf

Build your Android app Faster and Smaller than ever