简体   繁体   English

如何在Library项目中包含runtimeOnly依赖项,该项目将在我的Application中作为aar使用

[英]How to include runtimeOnly dependency in a Library project which will be consumed as aar in my Application

I want to include runtimeOnly dependency in an android library project, which has to be consumed by android app project. 我想在android库项目中包含runtimeOnly依赖项,必须由android app项目使用。 Now, when i declare runtimeOnly in android library project. 现在,当我在android库项目中声明runtimeOnly时。 Those dependencies are not available as part of apk 这些依赖项不是apk的一部分

You are using implementation or api ? 您正在使用implementationapi

According to your description you should use api in your library project, api will expose the dependency to the consumer in your situation consumer is your app project. 根据你的描述,你应该使用api库中的项目, api将公开依赖于consumer在您的情况consumer是你的应用项目。

Here is the duplicate question this may help you. 这是重复的问题,这可能对您有所帮助。 Answer1 Answer2 正确答案为 ANSWER2

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

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