从同一个项目构建.apk和.aar库 [英] Building .apk and .aar library from same project

查看:190
本文介绍了从同一个项目构建.apk和.aar库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用来自同一项目源的gradle构建apk和aar库?
挑战是修改build.gradle,以便两个产品都将被构建。你有什么建议吗?
最后,Gradle为我提供了一个非常简单的解决方案:
I'我已经使用Android Studio和Gradle创建了一个多模块项目(参见 http://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-creating-a-multi-project-build/ )。一个模块用于应用程序(Android应用程序项目),另一个模块用于库(Android库项目)。



将所有属于库的资源移动到库项目中,我可以构建.aar文件和.apk文件(也使用库项目中的源代码,因为多模块项目没有问题)。


is it possible to build an apk and an aar library with gradle from the same project source? Challenge is to modify the build.gradle so that both products will be built. Do you have any advice?

解决方案

Finally, Gradle offers me a really simple solution for this issue: I've created a multi module project with Android Studio and Gradle (see http://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-creating-a-multi-project-build/). One module for the app (Android Application Project) and one for the library (Android Library Project).

After moving all sources, that belong to the library, to the library project, I'm able to build the .aar file and the .apk file (which uses also sources from the library project, no problem thanks to the multi module project).

这篇关于从同一个项目构建.apk和.aar库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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