tags:

views:

107

answers:

3

I am new to Android development. I am using a x-platform development tool which builds and signs the APK for me. This tool has a bug and it does not generate APK's with the version code I specify, all APK's generated are version 1.0.

I would like to unpack the APK, edit the version code, and then resign and repackage it. It was signed using my keystore originally, so I have the keys needed to sign it again.

How can this be done?

A: 

I don't think that you can change the APK after it is packed and signed, since singing is there so that you actually can't change it anymore after signing.

What IDE are you using? E.g. Eclipse can also sign and build APK files and I've never seen a problem with the version number.

Roflcoptr
I'm not using an IDE
sylvanaar
not at all?? I never thought this is possible
Roflcoptr
It is possible.
Andrejs Cainikovs
+1  A: 

It should be possible; previously I've changed an existing APK's package name without access to the source.

However, you will probably need (and I don't have any more specific guides to hand):

  • a hex editor
  • a guide to the APK file format
  • a way of calculating the APK checksum

You need to unzip the APK, alter the (binary-packed) AndroidManifest.xml, alter the checksum in the resources.arsc (I think) and then re-zip the APK.

Actually, in searching for a couple of these resources, I came across apktool, which sounds promising.

Christopher
I have yet to try it, but I think your answer just what i was looking for.
sylvanaar
A: 

No, if it's signed.

Only the owner of key can change the .apk content.

JoaquinG
That's not true. The APK signature is separate to the code signature (checksum). You can re-sign an existing third-party APK with your own key, if you want.
Christopher
Its my key that was used to sign it. A 3rd party did the signing for me.
sylvanaar