简体   繁体   English

在Android库项目aar构件中包括来自Java库子模块的源

[英]Include sources from Java library submodule in Android library project aar artifact

I have a java library submodule holding interfaces which are used in another android library submodule. 我有一个Java库子模块,其中包含在另一个Android库子模块中使用的接口。 The problem is that the sources of the java library module are compiled but not included in the aar artifact of the android library project. 问题是Java库模块的源代码已编译,但未包含在android库项目的aar构件中。

How can I include the sources of the java library in the android library aar file? 如何在android库aar文件中包含Java库的源代码?

I ended up including the source files of the java library directly into the android library project using: 我最终使用以下命令将Java库的源文件直接包含到android库项目中:

sourceSets {
        main{
            java {
                srcDir("../java_library/src")
            }
        }
    }

Only this way the sources are included in the aar file. 只有这样,源才包含在aar文件中。 Still will be great to know if it is possible using simple gradle dependency management. 仍然很高兴知道是否可以使用简单的gradle依赖项管理。

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

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