简体   繁体   English

如何更改AndroidManifest.xml文件名?

[英]How to change AndroidManifest.xml file name?

I'm creating a build script for my CI and I want to change some fields in AndroidManifest.xml programmatically. 我正在为CI创建一个构建脚本,我想以编程方式更改AndroidManifest.xml中的某些字段。 So, I am running something like 所以,我正在运行类似

transform_my_manifest AndroidManifest.xml NewAndroidManifest.xml

Now I want to build my android app with NewAndroidManifest.xml as manifest file. 现在,我想用NewAndroidManifest.xml作为清单文件构建我的android应用程序。

Is there anything like 有什么像

ant -DManifestFile=NewAndroidManifest release

Or maybe I should put something in local.properties ? 或者,也许我应该在local.properties放一些东西?

PS I don't want to create AndroidManifest.xml.template in SCM and generate Mainfest file itself programmatically -- other developers use eclipse and quite happy, I don't want to bother them. PS我不想在SCM中创建AndroidManifest.xml.template并以编程方式生成Mainfest文件本身-其他开发人员使用eclipse非常高兴,我不想打扰他们。

PPS I can delete&rename for build process and rename&delete this file pair back at the end, but this is too "flammable" solution, I want better one. PPS我可以在构建过程中删除和重命名,并在最后重新命名和删除此文件对,但这是“易燃”的解决方案,我想要更好的解决方案。

Is there anything like: ant -DManifestFile=NewAndroidManifest release 是否有类似的内容:ant -DManifestFile = NewAndroidManifest版本

No, sorry, not with Ant. 不,抱歉,不和Ant在一起。 The new Gradle-based build system will allow you to create a manifest from component parts and configure parts of it dynamically via the DSL, which may help you achieve your objectives without transform_my_manifest . 基于Gradle新构建系统将允许您从组成部分创建清单,并通过DSL动态配置其中的一部分,这可以帮助您实现无transform_my_manifest的目标。

Or maybe I should put something in local.properties? 还是我应该在local.properties中放一些东西?

There is nothing in local.properties that affects the name of the manifest file used at compile time. local.properties中没有任何local.properties会影响编译时使用的清单文件的名称。

why not this: 为什么不这样:
1. transform_my_manifest AndroidManifest.xml NewAndroidManifest.xml 1. transform_my_manifest AndroidManifest.xml NewAndroidManifest.xml
2. rename AndroidManifest.xml oldAndroidManifest.xml 2. rename AndroidManifest.xml oldAndroidManifest.xml
3. rename NewAndroidManifest.xml AndroidManifest.xml 3. rename NewAndroidManifest.xml AndroidManifest.xml
4. build 4. build

?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM