I'm trying to use a custom build to repackage my Android app. I want to create an internal beta version which I can install side-by-side with my production app.
This answer looks like exactly what I need, however it doesn't seem to work.
Here's the update to my build.xml:
<target
name="-package-resources"
depends="-crunch" >
<echo>Repackaging AndroidManifest.xml to ${package.manifest.name} ${out.absolute.dir}/${resource.package.file.name}</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-f" />
<arg value="--auto-add-overlay" />
<arg value="-M" />
<arg path="AndroidManifest.xml" />
<arg value="-S" />
<arg path="${resource.absolute.dir}" />
<arg value="-S" />
<arg path="${android.library.reference.1}/res" />
<arg value="-A" />
<arg path="${asset.absolute.dir}" />
<arg value="-I" />
<arg path="${project.target.android.jar}" />
<arg value="-F" />
<arg path="${out.absolute.dir}/${resource.package.file.name}" />
<arg value="--rename-manifest-package" />
<arg value="${package.manifest.name}" />
</exec>
</target>
Running it seems to successfully run my new code:
ant debug -Dpackage.manifest.name=com.example.test
...
-package-resources:
[echo] Repackaging AndroidManifest.xml to com.example.test /<mypath>/bin/<appname>.ap_
...
BUILD SUCCESSFUL
However, when I use APKTool to inspect the APK, the package name in my AndroidManifest has not been changed to the new value. All that seems to have happened is that my relative activity paths ".MyActivity" have been expanded to my original package name.
apktool d --force bin/<appname>-debug.apk
Does anybody know what I'm doing wrong? I've looked at all the other Stackoverflow answers and most seem a little out of date. I am building with Android SDK Tools Revision 21.1.0, for minSdkVersion 8.
Update: As @athor comments below his answer, my assumption about inspecting the AndroidManifest.xml is wrong. To test this you actually need to try installing it rather than viewing the decompiled XML!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…