2

I have an apk file that I built using Adobe Phonegap Build. As described in this question, I have to modify the apk generated by Adobe Phonegap Build before uploading it to the Google Developer Console.

I can successfully edit the file, repack the apk, and "zipalign" it. However, I am stuck on signing it. Instructions I have come across on the web assume either that one is using Eclipse, or that one is on Windows. I am on Linux, I don't use Eclipse, and I am at the command line.

I understand that to sign my app I need to have signing keys on hand, but beyond that I am unclear on what commands I need and what the parameters are.

I was able to get the zipalign command from the Android SDK and run it as a standalone at the command line. I'm hoping that there is a similar way I can run a program at the command line to sign my app.

Is there a command I can use to sign my modified apk on the command line in Linux?

Community
  • 1
  • 1
Questioner
  • 7,133
  • 16
  • 61
  • 94

1 Answers1

2

For this you use standard Java SE tools: jarsigner and keytool.

From Android documentation on signing:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name

Remember that you should first sign and then align.

Grzegorz Żur
  • 47,257
  • 14
  • 109
  • 105