Specify a package name when creating an Android application

I have an Android app that is available for brands. We used the SDK v15 (4.0.x), and when creating the application through ant we specified package.name = com.blah.brand in the ant script properties. This will allow us to install the same application several times on the device, but each of them will be its own application and settings.

Since upgrading to SDK v16 (4.1), this no longer works, and I cannot find a way to change the packaging name when creating the application. Does anyone know how to do this?

+4
source share
2 answers

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

0
source

You can also change your ant build.xml. Add to this:

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

The manifestpackage property will change your package name.

0
source

Source: https://habr.com/ru/post/1436195/


All Articles