Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Modularizing your Android App
Search
Himanshu Singh
October 12, 2019
Technology
320
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Modularizing your Android App
This PPT is about Modularising your Android App using dynamic delivery.
Himanshu Singh
October 12, 2019
More Decks by Himanshu Singh
See All by Himanshu Singh
Debugging as a Skill
himanshoe
0
130
Elevating your App’s performance
himanshoe
0
95
FOMO in Android
himanshoe
1
970
Composing your Canvas : DroidCon
himanshoe
2
480
Composing in your Canvas
himanshoe
0
190
Backend Engineering for Android Developers
himanshoe
0
590
Mastering CameraX API
himanshoe
0
230
kotlin.pdf
himanshoe
0
140
Golang.pdf
himanshoe
0
190
Other Decks in Technology
See All in Technology
テックカンファレンス三大ステークホルダーの文化人類学 ─ 違いを認め合う関係性作り
bash0c7
5
1.5k
歴史から理解するクラウドインフラのしくみ
kizawa2020
1
200
StepFunctionsとGraphRAGを活用した暗黙知活用のためのRAG基盤
yakumo
0
200
AI Agent を本番環境へ―― Microsoft Foundry × Azure Serverless で作る Enterprise-Ready な基盤
shibayan
PRO
1
1k
最高のシステムプロンプトを作るためにフィードバック機能を導入した話
alchemy1115
1
270
実践が先生だった— 新卒サーバーエンジニア1年目のリアル
mixi_engineers
PRO
0
230
AIQAのナレッジ構築について
qatonchan
1
140
なぜ、あなたのエージェントは言うことを聞かないのか
segavvy
1
610
データと地図で読む 大井町の「かわるもの、かわらないもの」
yoshiyama_hana
0
900
20260801_スクフェス大阪
kgnkhkr
0
460
AI ネイティブな組織に Gemini Enterprise Agent Platform がなぜ必要なのか
asei
1
140
セキュリティ研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
32
27k
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
330
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Agile that works and the tools we love
rasmusluckow
331
22k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.5k
Utilizing Notion as your number one productivity tool
mfonobong
4
490
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
470
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
410
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
240
Paper Plane (Part 1)
katiecoart
PRO
1
10k
Transcript
Himanshu Singh @hi_man_shoe Modularizing your Android App
Himanshu Singh @hi_man_shoe About Me? Sr Android Engineer @roomiapp Instructor
and open source contributor @ Mindorks.com
Android Developers ?
Android Developers ?
Let’s Talk about the problem
Let’s Talk about the problem ચાલો શરૂ કરીએ ?
None
Module Bug Release Android Development Graph Feature
Solution to this ??
Multi - Modules
What and Whys of Multi Modules
Let’s talk about What
Let’s Talk about What Why
None
Library Modules Dynamic Delivery Modules
Library Modules Dynamic Delivery Modules
Let’s start with the code
Let’s start with the code
Create an Android Project (App Module)
Create an Android Project (App Module)
None
Create an Android Project (App Module) Goto File-> New ->
New Module and select Dynamic Feature Module (>Kitkat)
None
On the next screen, you will get a few options
to configure your module.
On the next screen, you will get a few options
to configure your module.
Press Finish :)
Final Project Looks like :)
What we want to achieve ?
<RelativeLayout> <Button android:id="@+id/buttonClick"/> <Button android:id="@+id/buttonOpenNewsModule android:visibility="gone"/> <Button android:id="@+id/buttonDeleteNewsModule" android:visibility="gone"/> </RelativeLayout>
android { ....... dynamicFeatures = [":news_feature"] } In app’s build.gradle
file
apply plugin: 'com.android.dynamic-feature' dependencies { ..... implementation project(':app') } In
new_feature’s build.gradle file
<dist:module dist:instant="false" dist:onDemand="true" dist:title="@string/title_news_feature"> <dist:fusing dist:include="true"/> </dist:module> In the manifest
of the dynamic Module,
<dist:module dist:instant="false" dist:onDemand="true" dist:title="@string/title_news_feature"> <dist:fusing dist:include="true"/> </dist:module>
<dist:module dist:instant="false" dist:onDemand="true" dist:title="@string/title_news_feature"> <dist:fusing dist:include="true"/> </dist:module>
implementation 'com.google.android.play:core:1.6.3' To make your module downloadable on demand add
the following in the app-module's build.gradle,
Pro Tip #1 • Treat the dynamic-module as the individual
app itself
dependencies { ..... api 'androidx.appcompat:appcompat:1.0.2' api 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.play:core:1.6.1' }
In the manifest of the app’s module,
This is our project
dependencies { ..... api 'androidx.appcompat:appcompat:1.0.2' api 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.play:core:1.6.1' }
In the manifest of the app’s module,
dependencies { ..... api 'androidx.appcompat:appcompat:1.0.2' api 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.play:core:1.6.1' }
In the manifest of the app’s module,
Let's learn how to make the dynamic-feature downloadable from the
app's module.
class MainActivity : AppCompatActivity() { lateinit var splitInstallManager: SplitInstallManager lateinit
var request: SplitInstallRequest val DYNAMIC_FEATURE = "news_feature" override fun onCreate(savedInstanceState: Bundle?) { .... } } In App’s MainActivity
override fun onCreate(savedInstanceState: Bundle) { .... initDynamicModules() } private fun
initDynamicModules() { splitInstallManager = SplitInstallManagerFactory.create(this) request = SplitInstallRequest .newBuilder() .addModule(DYNAMIC_FEATURE) .build(); } In App’s MainActivity
Implement Clicks :)
In App’s MainActivity override fun onCreate(savedInstanceState: Bundle) { ........ buttonClick.setOnClickListener
{ if (!isDynamicFeatureDownloaded(DYNAMIC_FEATURE)) { downloadFeature() } else { buttonDeleteNewsModule.visibility = View.VISIBLE buttonOpenNewsModule.visibility = View.VISIBLE } } }
In App’s MainActivity private fun isDynamicFeatureDownloaded(feature: String): Boolean = splitInstallManager.installedModules.contains(feature)
In App’s MainActivity private fun downloadFeature() { splitInstallManager.startInstall(request) .addOnFailureListener {
//on Failure Handle } .addOnSuccessListener { buttonOpenNewsModule.visibility = View.VISIBLE buttonDeleteNewsModule.visibility = View.VISIBLE } .addOnCompleteListener { } }
None
Let’s Open the News Activity
In App’s MainActivity buttonOpenNewsModule.setOnClickListener { val intent = Intent() .setClassName(this,
"com.mindorks.news_feature.newsloader.NewsLoaderActivity") startActivity(intent) }
In App’s MainActivity buttonOpenNewsModule.setOnClickListener { val intent = Intent() .setClassName(this,
"com.mindorks.news_feature.newsloader.NewsLoaderActivity") startActivity(intent) }
In App’s MainActivity buttonDeleteNewsModule.setOnClickListener { val list = listOf(DYNAMIC_FEATURE) splitInstallManager.deferredUninstall(list)
.addOnSuccessListener { buttonDeleteNewsModule.visibility = View.GONE buttonOpenNewsModule.visibility = View.GONE } }
Library Modules
Create an Android Project (App Module) Goto File -> New
-> New Module
None
And Use it how you use other libraries :)
Pro Tip #2 • Checkout Darshan’s Talk to understand this
module for the library creation
When ???
Library Modules Dynamic Delivery Modules
Library Modules Dynamic Delivery Modules
Why this approach ???
• Easily Manageable By Multiple Devs • Maintainability • Reduced
APK Size • Testing New Features
• Easily Manageable By Multiple Devs • Maintainability • Reduced
APK Size • Testing New Features
• Easily Manageable By Multiple Devs • Maintainability • Reduced
APK Size • Testing New Features
• Easily Manageable By Multiple Devs • Maintainability • Reduced
APK Size • Testing New Features
Link to project https://tiny.cc/gdgahm
Any Question? Himanshu Singh @hi_man_shoe
Thanks :) Himanshu Singh @hi_man_shoe