[COCOS2D-X] Creating APK for GooglePlay

When I first made an app for cocos2dx, the most challenging part was generating & uploading its 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 had 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 test 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!