Android games with CocoonJS

Stats

3,666 visits, 8,026 views

Tools

This tutorial will show you the steps needed to get your game on to Google Play / the Android Market.

This info was gathered from other tutorials and forum posts.

I make the following assumptions:

- You are on a Windows OS

- You know how to use Construct2

- You can navigate webpages and do general Windows stuff

The basic process goes like this:

- Create an account on Ludeis CocoonJS cloud compilation service

- Create an account on Google Plays developer portal ($$)

- Install JAVA and Android developer kits

- Create your game with the CocoonJS object

- Export your game to a CocoonJS compatible ZIP file

- Upload the ZIP file to Ludeis CocoonJS compilation service

- Receive a ZIP with two APK files in your mail (debug & release)

- Create a personal keystore file

- "Sign" the APK release file using your keystore file

- "Zipalign" the APK file, creating a new APK file

- Upload the new APK file to your Google Play developer portal

- Profit!

Once you have completed all these steps once you only need to do the following when making new versions / games:

- Export to a CocoonJS ZIP

- Upload to compilation service & receive files in mail

- Sign and zipalign APK file

- Upload to Google Play

For those of you who need a bit more info, follow the steps below :)

Step 1 - Create your game

Create a new project / add the CocoonJS "platform specific" object to your game.

Once you are done making your game, export it using the CocoonJS export module.

You should have a single ZIP file in a folder on your PC once the exporting finishes. This is the ZIP file that we will now upload to Ludeis cloud compilation service.

Step 2 - Compile

If you have not already made an account on Ludeis site, do so now.

Ludei Cloud Compilation page

I have not had to pay anything yet, but that could change.

Once you have made your account, you can add project(s) to their cloud compilation service. They require you to enter some information and add graphic resources to the project for iPhone and Android. Stuff like app version, different sized icons, and splashscreens.

Do all this and you should be able to upload your Construct2 exported ZIP file for compilation. When the "Compile project" button is clicked you should receive an email with your compiled Android APK files (one for debug, and one for release).

It usually takes about 10-30 minutes for Ludeis servers to compile your APK files.

Step 3 - Install developer kits

First off, I am not a wizard. I do not know exactly why you need to sign and align your Android APK files. Most likely it has to do with security, identifying you as the developer, optimizing the app structure, etc.

Getting more info about this is a job for you and Google :)

All we need to know is that it needs to be done for Google to accept your game to the Android market. So in that sense it's pretty damn important!

We need three pieces of software from these two kits;

- keytool and jarsigner from the JAVA JDK

- zipalign from the Android SDK

So what we need to do now is install the following:

- JAVA Developer Kit (JDK)

- Android SDK

I am using v.1.6.0_38 of the JAVA JDK. Do not use another version(!!). You will most likely not be able to install your game due to signing errors if you do.

When installed, the apps would be located in these folders, more or less.

- C:\Program Files (x86)\Java\jdk1.6.0_38\bin

- C:\Android-sdk\tools

You should be good to go when you can find the three .exe files on your PC!

Step 4 - Create a Keystore file

I am assuming we do all the following work in a folder called C:\Android. If you are going to be doing it elsewhere, replace the foldername in the following commands.

Now we need to create a key to sign your games with. This is a one time thing (as far as I know) and you should use this key to sign all your games. I'm not sure you would be able to update your game on the market with a new APK if you lost this key?

Go to the JAVA JDK folder and find the "keytool.exe". Open a command prompt (SHIFT+right click, in folder) and enter the following:

"keytool -genkey -v -keystore C:\Android[b]YOUR_IDENTITY.keystore -alias YOUR_IDENTITY -keyalg RSA -keysize 2048 -validity 10000"

(The YOUR_IDENTITY should be replaced with your Google Play developer name / alias)

You now have to fill in details like your name and most importantly a password (write it down somewhere!). Then you finish by typing Yes and pressing enter.

Now you should have a keystore file in your C:\Android folder.

Step 5 - Sign and Zipalign!

The final steps are actually the fastest.

Sign your APK release file using this command (may have to run it from the JAVA folder):

"jarsigner -verbose -keystore C:\Android[b]YOUR_IDENTITY.keystore C:\Android[b]NAME_OF_APK_FILE_unsigned.apk YOUR_IDENTITY"

You will be prompted for the password you entered when you created the keystore file.

When that is done, the APK file is ready for Zipaligning (might have to run this command from the Android SDK folder):

"zipalign -v 4 C:\Android[b]NAME_OF_APK_FILE_unsigned.apk C:\Android[b]NAME_OF_NEW_APK_FILE.apk"

This should result in a new APK file that is signed, zipaligned and ready for upload to Google Play.

Step 6 - Upload APK file to Developer portal

Go to your Android Developer portal page, and upload the APK file to the project that you have created there.

Click publish when done entering all the required info and wait 1-2 hours for game to appear.

And that should be it! :)

Feel free to ask questions.

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!