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

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

问题描述

是否可以使用来自同一项目源的 gradle 构建 apk 和 aar 库?挑战是修改 build.gradle 以便构建两个产品.你有什么建议吗?

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?

推荐答案

最后,Gradle 为我提供了一个非常简单的解决方案:我已经使用 Android Studio 和 Gradle 创建了一个多模块项目(参见 http://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-creating-a-multi-project-build/).一个用于应用的模块(Android 应用程序项目)和一个用于库的模块(Android 库项目).

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).

在将属于库的所有源移动到库项目后,我能够构建 .aar 文件和 .apk 文件(它还使用来自库项目的源,没有问题,多亏了多模块项目).

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天全站免登陆