SlideShare a Scribd company logo
1 of 38
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+
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

Similar to Build your Android app Faster and Smaller than ever

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

The ultimate guide to optimize your react native app performance in 2022
The ultimate guide to optimize your react native app performance in 2022The ultimate guide to optimize your react native app performance in 2022
The ultimate guide to optimize your react native app performance in 2022
 
React Native App Development.
React Native App Development.React Native App Development.
React Native App Development.
 
Geekle QA Summit 22.2_ The Curious Case of Mobile App Performance Testing.pdf
Geekle QA Summit 22.2_ The Curious Case of Mobile App Performance Testing.pdfGeekle QA Summit 22.2_ The Curious Case of Mobile App Performance Testing.pdf
Geekle QA Summit 22.2_ The Curious Case of Mobile App Performance Testing.pdf
 
React Native Market Overview for Cross-Platform App Development.pdf
React Native Market Overview for Cross-Platform App Development.pdfReact Native Market Overview for Cross-Platform App Development.pdf
React Native Market Overview for Cross-Platform App Development.pdf
 
Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete Guide
 
Progressive web application considerations before implementing magento pwa ...
Progressive web application   considerations before implementing magento pwa ...Progressive web application   considerations before implementing magento pwa ...
Progressive web application considerations before implementing magento pwa ...
 
Six Steps to Conversation Driven Development
Six Steps to Conversation Driven DevelopmentSix Steps to Conversation Driven Development
Six Steps to Conversation Driven Development
 
App42 Student Lab - Android Game Dev Series V 0.1
App42 Student Lab - Android Game Dev Series V 0.1App42 Student Lab - Android Game Dev Series V 0.1
App42 Student Lab - Android Game Dev Series V 0.1
 
14 Tips On How To Improve Android App Performance
14 Tips On How To Improve Android App Performance14 Tips On How To Improve Android App Performance
14 Tips On How To Improve Android App Performance
 
7 Crucial Things Every Android Developer Should Know
7 Crucial Things Every Android Developer Should Know7 Crucial Things Every Android Developer Should Know
7 Crucial Things Every Android Developer Should Know
 
Rakesh - Java Resume
Rakesh - Java ResumeRakesh - Java Resume
Rakesh - Java Resume
 
Goldark Presentation at Qualcomm QPrize 2014
Goldark Presentation at Qualcomm QPrize 2014Goldark Presentation at Qualcomm QPrize 2014
Goldark Presentation at Qualcomm QPrize 2014
 
How to hire mobile app developer
How to hire mobile app developerHow to hire mobile app developer
How to hire mobile app developer
 
Androidappdevelopmentpresentation
AndroidappdevelopmentpresentationAndroidappdevelopmentpresentation
Androidappdevelopmentpresentation
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
API-first design - Basis for an consistent API-Management approach
API-first design - Basis for an consistent API-Management approachAPI-first design - Basis for an consistent API-Management approach
API-first design - Basis for an consistent API-Management approach
 
9 Best Tools to Leverage for Progressive Web App Development
9 Best Tools to Leverage for Progressive Web App Development9 Best Tools to Leverage for Progressive Web App Development
9 Best Tools to Leverage for Progressive Web App Development
 
The Decoupled CMS in Financial Services
The Decoupled CMS in Financial ServicesThe Decoupled CMS in Financial Services
The Decoupled CMS in Financial Services
 
Sidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion UsersSidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion Users
 
Cloud Native Cost Optimization UCC
Cloud Native Cost Optimization UCCCloud Native Cost Optimization UCC
Cloud Native Cost Optimization UCC
 

More from LINE Corporation

More from LINE Corporation (20)

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

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

Build your Android app Faster and Smaller than ever