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.
Go to Windows PowerShell (command prompt) and type
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:\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.