我正在尝试通过命令行在Ant构建期间重命名我的Android应用程序。我想这样做,因为我想为不同的环境(测试,预生活,登台等)创建相同应用程序的不同版本。我能够更改软件包名称,versionName,versionCode,它允许我在单个设备上安装所有变种。现在我需要更改应用程序的名称,该名称来自
android.label
AndroidManifest中的。
我在custom_rules.xml中尝试了以下操作,但它无法正常工作
<target
name="-pre-build"
depends="-custom-manifest-version" >
</target>
<!-- change the version name and label for the application -->
<target name="-custom-manifest-version" >
<replaceregexp
byline="true"
file="AndroidManifest.xml"
match="android:versionName="/*.*""
replace="android:versionName="${app.newversionname}"" >
</replaceregexp>
<replaceregexp
byline="true"
file="AndroidManifest.xml"
match="android:label="/*.*""
replace="android:label="${app.newappname}"" >
</replaceregexp>
</target>
但这没有帮助,应用程序在发布时崩溃。
我尝试评论这些行
<replaceregexp
byline="true"
file="AndroidManifest.xml"
match="android:label="/*.*""
replace="android:label="${app.newappname}"" >
</replaceregexp>
它工作正常;这意味着这些线路有问题。