Mohtashim
Mohtashim

Reputation: 369

Android repackaging through ant debug and then ant release

I am new to ant scripting but want to achieve some task where I am totally stuck might some one can help me out with it,


What is the objective ?

  1. Android Project compiling through ant
  2. Repackage of the Android project from a command line from old to new.
  3. Then on new package, compile through command line to achieve the final sign apk.

What environment is setup?

  1. Mac using terminal command line , ant & SDK configured as home A single project already updated with "android-project-update -p" (generate build.xml , local.properties and others)

Problem to be solve. on build.xml following target added

<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="-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>

from the above added script in build.xml when run through

ant debug -Dapp.custompackagename=com.example.testpackageTwo

can successfully repackage the android project, and output apk is debug.apk but when run ant release on same project it execute.Then outout singed APK is not be able to install on device from ant release

- Is there any way to use conditions in ant script to switch between ant debug and ant release to by pass the above add script. - or any other way to get release apk. after repackaging from ant debug

Upvotes: 2

Views: 475

Answers (1)

serv-inc
serv-inc

Reputation: 38157

Android already offers the commands

android update project

and

ant debug install

and

ant release install

Upvotes: 1

Related Questions