简体   繁体   English

Android Instant App:功能模块:该模块不能是android库

[英]Android Instant App : Feature module : The module cannot be android library

I started converting my app to support instant feature , following the Google IO tutorial . 我开始按照Google IO教程转换我的应用以支持即时功能 I got the build running correctly. 我让构建正确运行。 I've disabled aapt2 and enableNewResourceProcessing as i was running into build errors . 当我遇到构建错误时,我已禁用aapt2enableNewResourceProcessing The module builds without errors after disabling those two flags but when i go to edit configuration of the base Feature of the app i get The module cannot be android library . 禁用这两个flags后,模块构建没有错误 ,但当我去编辑应用程序的基本功能配置我得到The module cannot be android library

Does anyone know what causes this issue. 有谁知道导致这个问题的原因。 I'm using com.android.feature plugin in the feature module's build along with build flavours and build types . 我在功能模块的构建中使用com.android.feature plugin以及构建风格构建类型

A feature module is treated as a library. 功能模块被视为库。 It doesn't have an application ID. 它没有应用程序ID。 So, "The module cannot be android library" error is generated. 因此,生成“模块不能是android库”错误。

The problem I was facing was that there was a build configuration for the instant feature as well. 我面临的问题是,即时功能还有一个构建配置。 Since each instant feature is considered as an android library, Studio throws errors saying module cannot be android library . 由于每个即时功能都被视为一个Android库,Studio会抛出错误,说module cannot be android library To solve this i simply removed the build configuration via 为了解决这个问题,我只需删除构建配置

Run -> Edit configuration -> Click on - button

Keep your base app module configuration and delete all other feature configurations. 保留基本应用程序模块配置并删除所有其他功能配置。

Don't run your feature . 不要运行您的feature Run your instantapp instead and set feature URL in it: 改为运行你的instantapp并在其中设置功能URL:

Run -> Edit Configurations -> Android App -> instantapp -> General -> Launch Options -> Launch = URL -> URL = https://example.com/my_feature 运行 - >编辑配置 - > Android应用程序 - > instantapp - >常规 - >启动选项 - >启动= URL - > URL = https://example.com/my_feature

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM