[COCOS2D-X] Creating APK for GooglePlay

When I first made an app for cocos2dx, the most challenging part was generating & uploading it’s apk file to GooglePlay. Making Apk releases for android apps was quite easy since, android studio made it so easy as a cake! However, When working with Cocos2dx, most of the tasks needed to be done by the terminal. And I really sucked at CMD & terminals.

So here’s a little memo about generating keystore file & apk for releases.

Let’s testing your app. If it’s bug free and great, it’s time to upload your app to Google play!
cocos run -s/Users/myself/Desktop/CocoFolder/MyGame -p android --android-studio

First, we will have to generate the keys. What is it for? It is used to authenticate yourself to anyone who is asking. Think of it as a license. After you generate your key, don’t forget to save your password and alias!
keytool -genkey -keystore mykey -alias mygame

After generating your keystone file, lets create the apk for google play. When you are asked for the keystone file, you can just paste the file location and click enter. If asked for the password use the one you created when you generated the Keystore file.

cocos run -s/Users/myself/Desktop/CocoFolder/MyGame -p android --android-studio -m release 

Where is my apk that has been generated? The location will be probably inside “build/outputs/apk. If not it should probably be in bin ?

/Users/myself/Desktop/CocoFolder/MyGame/proj.android-studio/app/build/outputs/apk/MyGame-release.apk

By the way, I wonder if there are developers out there still doing cocos2dx in 2017? Guess most of them moved on Unity5. Anyway, Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *