Why use the new Android feature plugin over the li

2019-02-21 14:47发布

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.

1条回答
小情绪 Triste *
2楼-- · 2019-02-21 15:37

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 an AAR file when the build targets a regular Android application (via plugin com.android.application) and an APK file for that module when the build targets an Instant App (via plugin com.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.

查看更多
登录 后发表回答