Android Dynamic Feature Modules: My Experience

  • I was able to reuse the code of my main module into the dynamic module (Classes, Resources, and almost everything) which is not possible in a normal module. As I was following MVP structure, I reused the same base classes. For resources also, there was no need to add them separately but to reuse from the main module.
  • I was able to implement Dependency injection and maintain it in the dynamic module separately.
  • As I planned to create a separate CameraActivity in my dynamic module, which was supposed to be launched from the main module, I didn’t get the reference of my dynamic modules classes in the main module classes. This was understandable as my main module was not dependant on the dynamic module but the other way around. To fix this issue and start my activity present in the Camera module I used the classpath to start the activity.
val intent = Intent().setClassName(packageName,
"<complete class path of camera activity>")
startActivity(intent)
java -jar <jar file path> build-apks --bundle=<aab file path> --output=<output file path>
java -jar ~/Desktop/release/bundletool-all-0.7.2.jar build-apks --bundle=~/Desktop/release/app.aab --output=~/Desktop/release/out.apks
unzip out.apks -d apks
java -jar ~/Desktop/release/bundletool-all-0.7.2.jar build-apks --bundle=~/Desktop/release/app.aab --output=~/Desktop/release/out.apks --ks <keytore file path> --ks-key-alias <alias>

--

--

--

https://agrawalsuneet.github.io/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

HP-ALM : A Software Testing Tool

Difference between OSI Model and TCP/IP Model

New Whitelist System | NFT Panda: World of Fantasy

Stanford Stanza as a REST-less Service

How APIs Become API Products

What I Learned at Work this Week: Python Arrow Library (and a bonus)

Design and Development of Toy OS for teaching operating system-I

CS371 Spring 2022: Hrithik Ramganesh

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Suneet Agrawal

Suneet Agrawal

https://agrawalsuneet.github.io/

More from Medium

Basics for your first Android App: REST API, Database, and Fragment Navigation

Room Database using ViewModel and live data-Kotlin-Part 1.

How to switch from one activity to another in Android Studio

Common errors found when generating Android certificates (and how to fix them!)