0

Hello im making an generic app that is configurable by xmls and files on res. Im trying to make differents apks from the same source of code. The problem is that im triying to do this by command line interface and i still dont find a way to change the package name and then build it in release mode.

I created my custom build.xml ant file and I tryed this solution,it generates 2 apks: MainActivity-debug.apk and MainActivity-debug-unaligned.apk but didnt work for me since the apk just built on debug mode and didnt even ran on emulator throwing [ INSTALL_FAILED_INVALID_APK].

So is there a way of doing this? The main problem isnt about debug or release mode since i think i just will have to use ant release command, is about creating an apk with different packages names so i can have both signed and running in same device.

Thank you!

Community
  • 1
  • 1
AmirG
  • 615
  • 8
  • 18
  • 2
    If you switch to doing your builds via Gradle for Android, you will be able to customize the package name (for its use in this "application ID" role) by build type (debug, release, etc.) or by product flavor. – CommonsWare Jul 02 '14 at 13:16
  • Hi i went for the gradle solution, worked like a charm!. Some usefull links: [JayWay](http://www.jayway.com/2013/02/26/using-gradle-for-building-android-applications/),[For release mode apks](http://stackoverflow.com/questions/18328730/how-to-create-a-release-signed-apk-file-using-gradle) – AmirG Jul 03 '14 at 16:00

2 Answers2

0

If you set your project as a Library project, you can use a facade style Project with it's own AndroidManifest.xml and overriding /res values to create a "custom" set of projects which derive from your main "Library" project.

Facade projects created in this way act the same in terms of functionality but can have different styles, package names, internal id's, colours, images (or even expose different intents or receivers).

Graeme
  • 25,714
  • 24
  • 124
  • 186
0

As commonsWare proposed i used Gradle for this solutions.

  • I used this tutorial for Gradle with android.
  • I used this answer for building apps in release mode
  • I used flavors also as commonsWare said, read this

Thanks a lot!

Community
  • 1
  • 1
AmirG
  • 615
  • 8
  • 18