通过gradle创建Android项目的zip及其依赖项 [英] Creating zip of android project along with its dependencies through gradle

查看:141
本文介绍了通过gradle创建Android项目的zip及其依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有三个不同依赖项的android项目(库项目),在完成构建后,我想为每个项目src文件夹创建一个zip文件。我做了以下事情,

I have an android project which have three different dependencies (library projects) and I want to create a zip of each project src folder after we are finished with the builds. I did the following,

task srcZip(type: Zip) {
    from projectDir
    println "SOURCE THE ZIP"
    exclude 'build'
    exclude 'gen'
    exclude 'bin'
}

但是要创建一个zip,我必须手动调用此任务。仅当我必须创建一个不包含其他依赖项(库项目)源的项目的zip文件时,此方法才有效。我如何一次创建所有源的zip?

In order to make a zip however I have to call this task manually. This works only if I have to create a zip file of one project which does not include the sources of other dependencies (library projects). How can I create a zip of all the sources at once?

预先感谢。

推荐答案

所以我能够自己解决问题,

So I was able to fix the problem on my own,

将以下内容复制到所有相关项目中,

Copying the following to all the dependent projects,

task srcZip(type: Zip) {
    from projectDir
    println "SOURCE THE ZIP"
    exclude 'build'
    exclude 'gen'
    exclude 'bin'
}

这篇关于通过gradle创建Android项目的zip及其依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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