Search code examples
androidcocos2d-xcocos2d-x-3.0

Unable to generate keystore and release cocos2dx project


I tried to generate the keystore however, Seems like it's not working. I'm not used to create the apk and release via terminal. So if I may be doing something wrong, it would be great if you can tell me some hints or samples.

My location of the project

/Users/myself/Desktop/CocoFolder/MyGame

Tried the following code. But not sure what to enter.

keytool -genkey -v -keystore /Users/myself/Desktop/CocoFolder/MyGame
 -alias MyGame -validity 10000

Planning to use this to create a release apk.

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

Solution

  • Two questions :

    1. How I generate keystore that required to sign your apk

      How can I create a keystore?

    2. Done you've now your keystore with specified alias name, Now you want to generate signed apk from your keystore.

      Put this into~/.gradle/gradle.properties

      RELEASE_STORE_FILE={path to your keystore}
      RELEASE_STORE_PASSWORD=*****
      RELEASE_KEY_ALIAS=*****
      RELEASE_KEY_PASSWORD=*****
      

      After that, Build --> Select Build Variant --> Set release for your game and build.