4

I have an Android application that is brand-able. We were using SDK v15 (4.0.x) and when building the application through ant, we would specify package.name=com.blah.brand in the ant properties script. This would allow us to install the same application multiple times on the device but each would be it's own application and settings.

Since upgrading to SDK v16 (4.1), this no longer works and I am unable to find a way to change the packing name when building the application. Does anyone know the new way on how to do this?

instigator
  • 1,587
  • 5
  • 15
  • 27

2 Answers2

0

I was able to do this through aapt and --rename-manifest-package as described here: Custom Android build.xml for rename manifest package

Community
  • 1
  • 1
instigator
  • 1,587
  • 5
  • 15
  • 27
0

Also you can modify your ant build.xml. Add this to it:

<target name="-package-resources" depends="-crunch">
        <do-only-if-not-library elseText="Library project: do not package resources..." >
            <echo level="info">packagin resources for package: ${project.app.package}</echo>
            <aapt executable="${aapt}"
                    command="package"
                    versioncode="${version.code}"
                    versionname="${version.name}"
                    debug="${build.is.packaging.debug}"
                    manifest="${out.manifest.abs.file}"
                    assets="${asset.absolute.dir}"
                    androidjar="${project.target.android.jar}"
                    apkfolder="${out.absolute.dir}"
                    nocrunch="${build.packaging.nocrunch}"
                    resourcefilename="${resource.package.file.name}"
                    resourcefilter="${aapt.resource.filter}"
                    libraryResFolderPathRefid="project.library.res.folder.path"
                    libraryPackagesRefid="project.library.packages"
                    libraryRFileRefid="project.library.bin.r.file.path"
                    previousBuildType="${build.last.target}"
                    buildType="${build.target}"
                    ignoreAssets="${aapt.ignore.assets}"
                    manifestpackage="NEW PACKAGE NAME HERE">
                <res path="${out.res.absolute.dir}" />
                <res path="${resource.absolute.dir}" />
            </aapt>
        </do-only-if-not-library>
    </target>

Property manifestpackage will change you package name.

Nickolai Astashonok
  • 2,878
  • 3
  • 20
  • 23