Android的库项目构建定制 [英] Android library projects custom builds

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

问题描述

我有一个遗留应用程序,并需要将其分割成一个库项目(普通code)和两个应用项目(付费和免费的应用程序)。我不使用Eclipse进行开发,也不要使用Ant构建提供的(产生的)由Android SDK(有几个原因:,融入了身材,CruiseControl的集成单元测试,自动构建不同的项目目录结构编号等),但使用我们的自定义生成的文件来代替。

I have a legacy application and need to split it into a library project (common code) and two application projects (paid and free applications). I don't use Eclipse for development, and also don't use Ant builds provided (generated) by Android SDK (there are several reasons for that: different project directory structure, unit tests integrated into the build, integration with CruiseControl, automatic builds numbering etc), but use our custom build files instead.

我需要修改我的Ant构建,使他们建立引用我的图书馆项目我的应用项目。我看着示例应用程序和Ant构建附带SDK,但不明白它是如何做。我看到库项目包含库目录
default.properties文件,android.library属性设置为真。我看到的应用项目包含android.library.reference.X属性设置为库项目目录值default.properties文件。但我没有找到在Ant这些属性的任何引用构建(项目Ant构建文件和Ant构建随SDK)。只要将这些文件到应用程序/库项目目录没有帮助,即SDK工具不跨preT他们。

I need to modify my Ant builds to make them build my applications projects that refer my library project. I looked into sample application and Ant builds shipped with SDK, but didn't understand how it is done. I saw that library project contains "libs" directory and "default.properties" file with "android.library" property set to "true". I saw that applications project contains "default.properties" file with "android.library.reference.X" property set to library project directory value. But I didn't find any reference to these properties in the Ant builds (project Ant build file, and Ant builds shipped with SDK). Just placing these files into application/library project directories doesn't help, i.e. SDK tools doesn't interpret them.

我的猜测是,这是由com.android.ant.SetupTask进行的,但我想知道它是如何进行的。我的版本是一套调用(使用EXEC)Android SDK工具的目标:聘任,DX,apkbuilder等。所以我想知道哪些命令我需要使用,使行参数,可以说,聘任工具来合并资源?

My guess is that this is performed by com.android.ant.SetupTask, but I'd like to know how it is performed. My build is set of targets that call (using exec) Android SDK tools: appt, dx, apkbuilder and so on. So I'd like to know which command line parameters I need to use to make, lets say, appt tool to merge resources?

感谢您提前。

推荐答案

我最近写了Ant构建脚本为我的Andr​​oid产品之一,使作为库的另一个Android的框架。我使用的诀窍是库项目中的 SRC,资源资产复制到主项目,然后用蚂蚁机器人的任务就是建设APK包。诀窍完美的作品对我来说。

I recently wrote ant build script for my one of android product that make use of another android framework as library. The trick I used was to copy src,resource and assets of library project into the main project and then use ant android task to build the apk package. The trick works perfectly for me.

让我知道如果你仍然需要一些帮助。

Let me know if you still need some help.

这篇关于Android的库项目构建定制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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