Leo Nguyen
Leo Nguyen

Reputation: 614

Build two apk with Ant

Please help me resolve a problem. I need to create a ant script which to build two apk with 2 packages name. The second apk'pakage need be renamed.Then rebuild use build.xml in sdk android. But this file is rather complicated. Im tried hard but it had no effect. Please tell me what I should do.

Upvotes: 0

Views: 162

Answers (1)

Rajesh
Rajesh

Reputation: 15774

Although not impossible, it will be quite some effort to achieve this because:

  1. You need to alter the package in the AndroidManifest.xml. This can be done with having 2 files that you select at run time. But currently, the name of the AndroidManifest.xml is a global property (manifest.file and manifest.abs.file which refers to the first). You should be careful to modify this as any change in the build.xml in the future by Android team can break your build.
  2. The R file that is generated will belong to the new package and the reference to this R from within your source code will fail because the new package is not imported (which has to be done in every source file that refers to R).

Upvotes: 1

Related Questions