0 Favourites

Signing a CocoonJS .apk file errors

  • I used the CocoonJS cloud compiler and successfully booted up a game on a test device - runs great and the cloud service was super-easy. I'm having a bit of trouble signing the official release .apk though.

    I've completed the first step of signing with keytool, using this command-line string:

    keytool -genkey -v -keystore C:\Android\salmonsez.keystore -alias salmonsez -keyalg RSA -keysize 2048 -validity 10000  

        

    It generates the file and everything. However when I run jarsigner for the next step with this string:

    jarsigner -verbose -keystore C:\Android\salmonsez.keystore -storepass **** -keypass **** C:\Android\ss\Salmon_Sez_release.apk Salmon_Sez_release.apk salmonsez

    it gives me this error:

    jarsigner: Certificate chain not found for: Salmon_Sez_release.apk.  Salmon_Sez_release.apk must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

    What am I missing here?

  • jarsigner -verbose -keystore C:\Android\salmonsez.keystore C:\Android\Salmon_Sez_release.apk salmonsez

    Worked. Sorry to bother anyone, don't know what the issue was though.

  • I tried to like you but I do not really understand how. I installed Eclipse and the Android SDK but I'm a little lost, can you help me please? Sorry for the bad english, I'm french.

  • I'm going to write up a more detailed walk through of what I did because now it really is super easy. I'll let you know when I've gotten it finished.

  • Oh stevo301103, please wtire a tutorial about this process!

  • I'm going to write up a more detailed walk through of what I did because now it really is super easy. I'll let you know when I've gotten it finished.Thank you very much!

  • I'm going to write up a more detailed walk through of what I did because now it really is super easy. I'll let you know when I've gotten it finished.

    This would be greatly appreciated.

  • So, here's a step-by-step for signing, using Construct 2, CocoonJS Cloud Compiler, the Java Development Kit & the Android SDK on Windows 7.

    1. Install all prerequisites:

    I used default values for everything, apparently this can cause an issue with the path variables (like directions to executable files given by the computer) - so you may want to locate everything in a simple directory like C:\Java. As it was I installed everything a long time ago and had yet to run into this situation, so I had to set a new PATH variable from the command line after I updated my Android SDK.

    echo %JAVA_HOME%

    will tell you where your Java Developer Kit is installed, a folder named /jdk.#.#.# (jdk followed by the current version number). Mine was installed in the /Program Files/Java/ directory, so before signing I had to set the java home, replace jdk.# with your folder name.

    set JAVA_HOME = C:\Programs Files\Java\jdk.#.#.#

    2. Create a folder at C:\Android, it'll make these next steps easier.

    3. Next you have to generate a unique KEYSTORE using the Java tool Keytool - located in your jdk.#.#.# folder, my default location was:

    Program Files\Java\jdk1.6.0_26\bin

    Open a Command Prompt window on the \bin folder by holding SHIFT and right clicking in file explorer and choosing Open Command Prompt Here. At the command prompt type:

    keytool -genkey -v -keystore C:\Android\YOURAPPNAME.keystore -alias YOURAPPNAME -keyalg RSA -keysize 2048 -validity 10000

    Replacing the parts I put 'YOURAPPNAME' with your app. You'll be asked for name, company and location details and well as for two passwords. Set all these and remember them well. Once you've signed and uploaded a file you'll have to use the same key file each time you update it. I've saved the signing settings for each app as a text file to make this process a simple cut and paste operation.

    4. Use Jarsigner to sign your app file from CocoonJS. Unzip the file they sent you and drag the "Release_Unsigned.apk" version to your C:\Android folder, rename it to something easy like "Your_App_Name_release.apk". In the Command Prompt window we opened in the last step, type:

    jarsigner -verbose -keystore C:\Android\YOURAPPNAME.keystore C:\Android\YOURAPPNAME_release.apk YOURAPPNAME

    If you don't get errors you can move onto the final step.

    5. You can close the Command Prompt window now. We'll open another one from the location of our Android SDK installations Tools folder. My default location was at:

    C:\Program Files (x86)\Android\android-sdk\tools

    SHIFT+Click on the Tools folder and choose Open a Command Prompt Here. Then type:

    zipalign -v 4 C:\Android\YOURAPPNAME_release.apk C:\Android\YOURAPPNAME_releaseYOURRELEASENUMBER.apk

    To generate a final, uploadable file. It will generate a file with Your_App_Name_release001.apk to upload to the Google Play store. Remember, once it's done and uploaded you have to keep using this same keystore, so back it up and protect the access codes so you can continually update the same listing in the store. Changing this keystore value requires uploading your new app version as a whole new store listing.

    Once you've uploaded a version and go back to update the listing later, you'll just do the last two steps, Jarsigner and Zipalign using the KEYSTORE file you created for the first step.

  • Thank you for taking the time to write this tutorial.

    But I followed your tutorial, I have no error, but when I upload the file to Google play he said: "The server could not process your apk. Please try again."

    Have you any idea why?

  • Can you post how you're setup and what steps you're doing? I've also had some issues with the google developers console that required me to use another browser to access it. Chrome had some lingering signins from other Google products and it was screwing up some of the saving and settings.

  • The only thing I did differently from your tutorial is the beginning, I have kept the default directories because I had already installed.

    If I put the java jdk in c :/ I do not understand where to type echo% JAVA_HOME%

    Does having checked minifying can cause the problem?

  • setting the JAVA HOME can be done from anywhere I think... if you go to START > RUN > and type 'cmd' you'll get a Command Prompt window from your default windows location, then you can set the JAVA HOME variable following that step. Let me see if I can go back and clarify that in the write-up.

    As for 'Minify' I haven't had any issues with that. I have had various issues pop up if I use the 'Brute' method of compression. But I just make everything as compressed as possible outside of Construct to keep things light there. All minify does is make your game's code at runtime less readable by compacting variables and functions (or at least that's my understanding).

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • I have set %JAVA_HOME% in c:/Program Files/Java/jdk1.7.0_07 and echo %JAVA_HOME% which shows me the directory defined.

    I started all the steps but I have the same r�sultat.Je do not understand what I am doing wrong.

  • Hmmm, well I've run into a few issues using this method, so I'd hold off on using it as a guide. Waiting for CocoonJS to update the permissions required by compiled apps, and a few other things. Will revisit this topic when I move forward with my next round of tests.

  • stevo301103

    EXCELLENT TUTORIAL...!!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)