定制Android清单的一部分 [英] Customizing parts of Android Manifest

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

问题描述

我开发的,我要出货几种不同的APK在市场上不同的语言(每种语言,包括文件的一个巨大的包,我想,以避免造成1巨大的APK所有语言包)Android应用程序。

I am developing Android application for which I want to ship several different apks for different languages in the market (every language includes a huge bundle of files and I want to avoid creating one huge apk with all language bundles).

所以,我需要的是为每种语言定制了一下清单文件:如包装上的应用程序,并可能是应用程序版本等。我知道我可以模板清单,以便我可以手动插入的文件在我的某些点的值(见<一href="http://stackoverflow.com/questions/10569760/android-how-do-i-dynamically-set-the-package-name-at-build-time-for-an-open-so">this帖子)。问题是,我用蚂蚁为preparing我生产的apk,但除此之外,我开发使用Eclipse的,所以我需要我的项目在IDE中工作过。 Eclipse中需要完整的清单文件,也不会明白我将用于蚂蚁的模板建立的,据我所知(请人证明我是错的)。

So what I need is to customize a bit the Manifest file for each language: e.g. the package of the application and possibly the application version etc. I know how I can template the manifest so that I can manually insert my values in certain points in the file (see this post). The problem is that I use ant for preparing my production apks, but otherwise I develop using Eclipse and so I need my project working in the IDE too. Eclipse requires complete Manifest file and will not understand of the templating I will use for the ant builds as far as I know (please somebody prove me wrong).

我的问题是,我想避免坚持认为在很大程度上是(一个模板,一个完整的适用于Eclipse)相同的两个清单文件。目前我能想到的两种可能的方法,但我不知道如何去实现它们:

My problem is that I want to avoid maintaining two manifest files that are identical in large part (one templated and one complete for Eclipse). Currently I can think of two possible approaches, but I do not know how to accomplish them:

  • 使用某种定义注射液在清单文件:如果我能在AndroidManifest文件的身体注入一定的XML文件,我可以保持相同的部分在一个XML部件和定制的区别只是点
  • 如果有可能配置Eclipse使用Ant任务一些序列构建Android项目,而不是prebuild套路我也许能我在IDE中建立自己的生产的APK的方式进行整合。

请,如果有任何人谁知道如何完成任何的以上两种,或有任何其他的想法如何,我可以解决我的问题:帮助

Please if there is anyone who knows how to accomplish any of the above two, or has any other idea how can I solve my issue: help!

推荐答案

取蚂蚁看看替换任务:

<replace file="${build.out}/src/config.prop" token="@@@" value="${build.version}-${build.type}"/>

但同样,你要小心,他们是独一无二的。

But again you should be careful with values that they are unique.

您也可以与生成的清单由 echoxml 任务来代替你的日食清单。

You could also replace your eclipse manifest with generated manifest by echoxml task.

或者你也可以重复使用这个漂亮的任务有关XML操作。

Or you could reuse this nice task about xml manipulation.

这篇关于定制Android清单的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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