Android recently came out with a new com.android.feature
plugin to be used to split up applications into features for the new Instant apps. It seems to be an architecture they are recommending in general, not just for features you are splitting up for instant apps. You can do some reading about it's usage here.
What I'm failing to understand is what this plugin actually does better / differently than the normal android-library
plugin. I ask, because my team is legitimately considering splitting up our code into feature modules, for reasons that have nothing to do with Android instant apps, and I'm not understanding what the benefit to using the com.android.feature
plugin is.
The new feature plugin (
com.android.feature
) is actually almost identical to the existing library plugin (com.android.library
) in the way it behaves and the way it's used.The key difference is that the library plugin will always output an Android Archive (
AAR
) file where the feature plugin is able to output anAAR
file when the build targets a regular Android application (via plugincom.android.application
) and anAPK
file for that module when the build targets an Instant App (via plugincom.android.instantapp
).What are the benefits right now? Currently you only need to use the feature plugin to build for Google Play Instant (previously called Android Instant Apps). There are minimal benefits right now to using the feature plugin if you are NOT planning to build for Google Play Instant. One minor benefit might be you can output
APKs
for each module of your app and could install and test them independently.