From Cordova export to signed APK with Cordova CLI on Windows 10

  • 8 favourites



13,527 visits, 25,117 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.


You made a game you wanna publish on android. First thing you got to figure out what is the oldest android versions you wanna support. For my beta I chose 5.0 as oldest, so I only have to sign one APK every update.

To build a release APK from a construct 2 export there are a number of tools necessary.

Install JAVA SE Development Kit 8 – Not 9 or10. At the moment (april 2018) Cordova requires 8.

Install Android Studio. If you install as default, the paths given later in this tutorial are close to yours.

Install all needed SDK's

Start Android Studio. Click on Configure and the SDK Manager. You get a list of all available android SDK’s. Check the SDK’s you wanna install and press Apply.

The newest stable SDK is installed by default. 6.0 and 5.0 SDK, are installed on my PC as well. But I think only the targeted SDK is necessary.

Anyone knows for sure what SDK's need to be installed exactly?

Install Node.JS. This is the platform on which the Cordova CLI works.

Install Cordova

Go to Windows PowerShell (command prompt) and type

    npm install -g cordova

When this fails you probably have to manually add the path to the nodejs folder (something like c:\Program Files\nosejs[/i])to the path. See Next section on how to do so.

Now you have the tools you need. But the change things work now is small, because Windows PowerShell can not find the tools you need. So we gone help Windows by editing the environment variables. Some manuals add 2 folders to PATH others 3. Since it does not realy harm, I added 3, in line with the cordova documentation.

Cordova - Android Platform Guide

1. Use system search (The magnifying glass next to Start or the search field you see after you clicked start) and type system (if your system language is not English you might wanna use the correct translation for that)

2. Click advanced system setup (my system is in dutch so not sure what it says in English)

3. Chose Environment variables

4. Click New and add ANDROID_HOME with the value pointing to the folder your

    c:\Users\%your user name%\AppData\Local\Android\Sdk

5. Select the System variable Path and click edit. The path names the folders that windows looks through to find a command you give via the command prompt.

6. Add these 3 folders to PATH so cordova can find the files it needs:

    c:\Users\%your user name%\AppData\Local\Android\Sdk\tools
    c:\Users\%your user name%\AppData\Local\Android\Sdk\tools\bin
    c:\Users\%your user name%\AppData\Local\Android\Sdk\platform-tools 

7. For signing the APK before publishing we need some JAVA commands. We can move around the folders in the command prompt. But I find it easier and faster to stay in the build folder so I added the JAVA bin folder to the path.

For the last step we need zipalign, a command sitting in the android sdk build-tools subfolder. So I added the android build tools folder to the path too.

    C:\Program Files\Java\jdk1.8.0_161\bin
    C:\Users\%your user name%\AppData\Local\Android\Sdk\build-tools\27.0.3

These to path’s have version numbers in them. So they may stop working after an JAVA, Android Studio update.

8. Close the system editing windows and restart your PC to make sure Windows uses the path’s given. Some manuals say starting a new PowerShell is enough to make it use the new variables.

Instead of using system→advanced…(1-3). You can search for environment variables (if your system language is not English you might wanna use the correct translation for that). But then you have to chose the variables connected to your account or system. Both should work, but I did it the way described above.


  • Order by
Want to leave a comment? Login or Register an account!
  • 你好 我好久没有更新C2了。近期发现更新到r261 以上的版本。 CORDOVA CLI build 出来的android APP 无法在手机里面打开。黑屏无法启动APP. 能帮帮我么?

    R261无法BUILD API 28

    你好 我好久没有更新C2了。近期发现更新到r261 以上的版本。 CORDOVA CLI build 出来的android APP 无法在手机里面打开。黑屏无法启动APP. 能帮帮我么?

    R261无法BUILD API 28

    Hello, I haven't updated C2 for a long time. Recent updates have been found to be more than r261. Android APP built by CORDOVA CLI cannot be opened in the phone. Black screen can't start APP. Can you help me?

    R261 cannot BUILD API 28