Export to Cordova

Setting you project information like picture below:

On Construct 2

On Construct 2 File on the left top corner then click export and then select Cordova then click next.

On Construct 2

 

Export to “C:\” or other location, in this example I export files to drive c:\ and folder name is Your_Game_Name.

On Construct 2

Check Hide status bar , Android, any other platform(.ogg) and select minimum Android is 5.0+ (Lollipop / API Level 21) then click export.

On Construct 2

After finished export from Construct 3, extract the exported files Cordova Project to C:\Your_Games_Name

Inside exported files folder, use text editor to open config.xml then change:

<preference name="android-targetSdkVersion" value="26" />

to

<preference name="android-targetSdkVersion" value="28" />

and then save and now open config.json and change:

"target": 26,

to

"target": 28,

Now open command prompt and go to Cordova Project folder in this example C:\Your_Game_Name and type on command prompt:

cd\

cd Your_Game_Name

cordova prepare

and the result should like picture below:


Build Debug APK

If you want build debug apk then type on command prompt:

cordova build android

and the result below:

You can found the debug apk file on this folder

Your_Cordova_Project_Folder\platform\android\app\build\outputs\apk\debug


Build Release APK

On command prompt type:

cordova build –release android

and the result should like picture below:

The release apk file is unsigned, before you can upload it to Google Play Store we need to signing the release apk. You will need a keystore for signing process and now we create a keystore.


Create a Keystore

Go to release apk folder via command prompt and make sure your current directory on command prompt on C:\Your_Game_Name then type:

cd platforms\android\app\build\outputs\apk\release\

then press enter and type:

keytool -genkey -keystore Your_Keystore_Name.keystore -alias Your_Alias_App -keyalg RSA -keysize 2048 -validity 9999 -v

You will asked create a password, create your password and remember it. Then after you fill all the questions and keytool will asking about all your input data is correct? Then type yes, see picture below.

You can find your keystore on the same folder release apk, see picture below:


Signing APK

And the last step we use jarsigner for signing the release apk. Make sure your command prompt on release directory then type:

jarsigner -sigalg SHA1withRSA -digestalg SHA1 -verbose -keystore Your_Keystore_Name.keystore app-release-unsigned.apk Your_Alias_App

then enter your password, the final result should like picture below:

Now your APK is ready to upload to Play Store and remember always keep your keystore and do not lose the password. Thank you for reading.


Creative Commons LicenseThis article is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.