1 Reply Latest reply on Apr 21, 2017 8:24 AM by richardh2664448

    Problems with signing a Phonegap APK and -debug setting


      Hi, I am stuck.


      to test phonegap for my use I have done the following, (on Mac BTW):-


      1. Used the hello world example almost untouched only a simple calculator tool added to index


      2. It all works perfectly in emulators and the apk runs on my phone.


      3. I created a digital signature using this method:-


      keytool -genkey -v -keystore yourappname.keystore -alias appnamealias -keyalg RSA -keysize 2048 -validity 10000


      (just to confirm, I did put my own app name and alias in:)  )


      all worked fine.


      4. When adding the key to package on phonegap it gives an error suggesting the alias name is wrong, but it is not.


      5. So I downloaded the apk from phonegap and used this method to sign it


      jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my.keystore my-app.apk my_alias_nam


      (with my own names etc)

      this is the error I get:-

      jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 5567 but got 5157 bytes)


      6.    Googling I find that this may be due to dubugging being on ( I forgot about that)


      7.    I unchecked enable debugging in settings on phongap control panal and checked config.xml


      8.  I Reuploaded a zip to phonegap, I rebuilt without signature.  but the resulting apk download still seems to download a -debug.apk file.


      9.   following a link on your forum I used apktool to check the files, and debuggable is set to true.




      10. I have stripped all packages from the app and config.xml and the packages built on phonegap still show -debug.apk


      11. What else can I do?





        • 1. Re: Problems with signing a Phonegap APK and -debug setting
          richardh2664448 Level 1


          I have resolved this.   In phonegap when you submit a key you are asked for two passwords, the certificate password  and the keystore password.  I misunderstood what the certificate password was.   when you create your keystore you are likely to have chosen the same password for both.  In my case I did, so I use the same password in both input boxes and all now works.  I'm sure this is obvious to most but I am very rusty on keystores.

          Amazing what a half an hour break and a cup of tea can achieve!