为什么要在库插件上使用新的Android功能插件? [英] Why use the new Android feature plugin over the library plugin?

查看:53
本文介绍了为什么要在库插件上使用新的Android功能插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android最近推出了一个新的 com.android.feature 插件,该插件可用于将应用程序拆分为新的Instant应用程序的功能.他们似乎在总体上推荐这是一种体系结构,而不仅仅是为即时应用拆分的功能.您可以此处./p>

我无法理解的是,这个插件实际上比普通的 android-library 插件做得更好/有所不同.我问,因为我的团队出于与Android即时应用无关的原因,正在合理地考虑将我们的代码拆分为功能模块,而且我不了解使用 com.android.feature <有什么好处/code>插件是

.

解决方案

更新(截至2019年5月):对于绊倒这篇文章的任何人,下面的详细信息基本上都是-现在.功能插件( com.android.feature )不再是新"的,实际上已被弃用,以支持即时启用的App Bundle.在官方的博客文章中了解有关此内容的更多信息.a>.

新功能插件( com.android.feature )实际上在行为和操作上与现有库插件( com.android.library )几乎相同.使用方式.

主要区别在于,库插件将始终输出Android存档( AAR )文件,当构建目标定位时,功能插件能够输出 AAR 文件常规版本的Android应用程序(通过插件 com.android.application )和该模块的 APK 文件(当构建针对Instant App时)(通过插件 com.android.android..instantapp ).

现在有什么好处?目前,您只需要使用功能插件即可为 Google Play Instant (以前称为Android Instant Apps).如果您不打算针对Google Play Instant进行构建,那么现在使用功能插件几乎没有什么好处.一个较小的好处是您可以为应用程序的每个模块输出 APK ,并可以独立安装和测试它们.

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.

解决方案

Update (as of May 2019): for anyone stumbling on this post, the details below are largely out-of-date now. The feature plugin (com.android.feature) is no longer "new" and is actually now being deprecated in favour of instant-enabled App Bundles. Read more on that in the official blog post.

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.

这篇关于为什么要在库插件上使用新的Android功能插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆