Sign a CocoonJS APK

0 favourites
  • 5 posts
  • I've looked through the forums, and read through many different sites, however I simply do not get it.

    For Tizen we had a nice tutorial with step by step instructions, explaining which software we need and maybe even some screenshots. For Android, we have garbled cmd prompt text and tutorials that appear to start off half way.

    It's a little unusual to see posts which go way over my head, followed by another poster saying "Wow, thanks, it's so easy!"

    Is there anyone out there than can provide a nice tutorial, or even sign my apk for me?

    How long does the process take?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi. Here is a guide that might help... i dont have permission to post directly to the source (Sort it out Admin!).

    To begin with make sure you have keytool, jarsigner, ant etc. commands working from your command prompt. If not then install them, just google for those packages.

    You will require OpenSSL as well required to generate your secret key for the application. Installing this is slightly tricky but the easiest way is to install Cygwin and during the installation you can choose to install OpenSSL. After this you will mostly be set to create your .apk.

    Step 2: Goto the /android folder and you will see bin, lib, res etc. (i could not find an apk file kind of freaked out the first time but not to worry all the files needed for creating the .apk are in here)

    Step 3: Open command prompt and get to your /android folder

    Step 4: Type the following command to generate your secret key that will be required for signing your application:

    C:\Desktop\<sketchname>\android> keytool -genkey -v -keystore <sktechname>-release-key.keystore -alias <your name or anything> -keyalg RSA -keysize 2048 -validity 10000

    It will then ask you the following questions:

    Enter keystore password:

    Re-enter new password:

    What is your first and last name?

    [Unknown]:

    What is the name of your organizational unit?

    [Unknown]:

    What is the name of your organization?

    [Unknown]:

    What is the name of your City or Locality?

    [Unknown]:

    What is the name of your State or Province?

    [Unknown]:

    What is the two-letter country code for this unit?

    [Unknown]:

    Is CN=name , OU=name, O=name, L=blah, ST=PA, C=US correct?

    [no]: yes

    Generating 2,048 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 10,000 days

    for: CN=name, OU=name, O=name, L=blah, ST=PA, C=US

    Enter key password for <your alias>

    (RETURN if same as keystore password):

    Re-enter new password:

    [Storing -release-key.keystore]

    ????????????????????

    This creates a <appname>-release-key.keystore file in your /android folder.

    ??????????????????????????????????????

    Step 5: Now we create the .apk file which is unsigned. So type in the following:

    C:\Desktop\<appname>\android>ant release

    ?????..

    ?????..

    BUILD SUCCESSFUL

    Total time: 12 seconds

    ??????????????

    You should get this in your console if the build is successful.

    ????????????????????????????????????????

    Step 6: You can now see in your bin folder the .apk file named as <appname>-unsigned.apk (Yay!)

    Step 7: Now you will need to sign this with your secret key in order to release it on the android market. So here goes, (you can choose to copy the keystore file into your bin folder and execute the following command (too lazy to type too many characters) or keep it where it is.

    C:\Desktop\<sketchname>\android>jarsigner -verbose -keystore <appname>-release-key.keystore c:\Desktop\<sketchname>\android\<appname>-unsigned.apk <your alias>

    Then you will get a bunch of statements such as

    Enter Passphrase for keystore:

    adding: META-INF/MANIFEST.MF

    adding: META-INF/ALIAS.SF

    adding: META-INF/ALIAS.RSA

    ?????

    ????.

    signing: assets/ComicSansMS-25.vlw

    signing: assets/CurlzMT-150.vlw

    signing: assets/SegoePrint-60.vlw

    signing: res/drawable/icon.png

    signing: res/layout/main.xml

    signing: AndroidManifest.xml

    signing: resources.arsc

    signing: res/drawable-hdpi/icon.png

    signing: classes.dex

    ??????????????-?????

    Step 7: We are almost done! So we need to verify the previous step i.e. we need to make sure that jarsigner has signed the app correctly.

    So execute the following:

    C:\Desktop\<sketchname>\android>jarsigner -verify c:\Desktop\<sketchname>\android\<appname>-unsigned.apk

    jar verified.

    You should get JAR VERIFIED else something maybe wrong.

    Step 8: Now to create your signed and distributable .apk file

    C:\Desktop\<appname>\android>zipalign -v 4 c:\Desktop\<appname>\android\<appname>-unsigned.apk <new appname>.apk

    Verifying alignment of <appname>.apk (4)?

    50 META-INF/MANIFEST.MF (OK ? compressed)

    973 META-INF/ALIAS.SF (OK ? compressed)

    1958 META-INF/ALIAS.RSA (OK ? compressed)

    3094 assets/ComicSansMS-25.vlw (OK ? compressed)

    23456 assets/CurlzMT-150.vlw (OK ? compressed)

    205025 assets/SegoePrint-60.vlw (OK ? compressed)

    ???

    ???.

    7002884 res/drawable/icon.png (OK)

    7005452 res/layout/main.xml (OK ? compressed)

    7005745 AndroidManifest.xml (OK ? compressed)

    7006548 resources.arsc (OK)

    7007504 res/drawable-hdpi/icon.png (OK)

    7011152 classes.dex (OK ? compressed)

    Verification succesful

    Hurray we are all set.

  • Yup... thanks for the detailed explanation, but again, right over my head. Maybe I just don't do well with walls of text, or maybe I don't do well with "make sure you have keytool, jarsigner, ant etc. commands working from your command prompt"

    The etc just makes me shrug.

    Also, step 5 is talking about creating an APK. I already have an unsigned APK, seeing as I used CocoonJS. Does this mean I jump straight to step 6?

    I find it hard to believe that there are so many steps, and not an all in one package.

    I used another program to try to sign my apk, but although it said it was fine, when I added it to my mobile and tried to install it, it just error coded and closed. No details.

    Again, I work well with links and screenshots. According to your tutorial, I require at least 5 different programs, and apparently a lot of time to spend on trial and error.

    I'm not meaning to sound unappreciative... but I'm not technically minded like this. I can build a game no problem, but this just goes over me. I guess I'm spoiled by simple processes.

  • There is a tutorial on it, I followed it to do mine and it has all the steps... Android Games with CocoonJS not sure why this didn't show up in your searches...

  • You may also want to look at Ludeis instructions on this as it isn't a Scirra thing.

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