如何自动版本code递增的Andr​​oidManifest?版本、code、oidManifest、Andr

2023-09-06 00:18:02 作者:春天里

我有上传到颠覆/ SVN回购申请。是否可以使用脚本以某种方式改变存储在 AndroidManifest 应用程序版本code?我的意思是在/结账后/更新?

 <舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
          包=mypackage的
          安卓版code =100000
          机器人:VERSIONNAME =1.0>
 

解决方案

SVN具有的关键字替换,你可以用它来把版本号在文件中。然而,这将导致在修订时,清单文件本身最后更改,这是不是你想要的。

最好的方式来实现你想要的是调用 svnversion,如果从构建脚本,并嵌入清单文件的输出从那里。你可以有版本控制下,可用于构建脚本生成真正的清单文件中的 manifest.template 文件。把一个占位符字模板中,并通过与 svnversion,如果获得的版本号替换它。

修改:在Eclipse中,你大概会使用Ant脚本,和普通身材之前调用它。链接的例子生成的版本号一类的文件,但你也可以产生一个非常相似的方式manifest文件。

I have application which uploaded into Subversion/SVN repo. Is it possible to use script to somehow change application version code stored in AndroidManifest? I mean during/after checkout/update?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="mypackage"
          android:versionCode="100000"
          android:versionName="1.0">

解决方案

SVN has keyword substitution which you can use to put the revision number in a file. However, this will result in the revision when the manifest file itself was last changed, which is not what you want.

The best way to achieve what you want is to call svnversion from your build script, and embed the output in the manifest file from there. You could have a manifest.template file under version control which can be used by your build script to generate the real manifest file. Put a placeholder word in the template and replace it by the revision number obtained with svnversion.

edit: in Eclipse you would probably use an Ant script, and invoke it before the normal build. The linked example generates a class file with the revision number, but you could also generate a manifest file in a very similar way.