{"id":1194,"date":"2022-01-30T16:07:59","date_gmt":"2022-01-30T16:07:59","guid":{"rendered":"http:\/\/www.netexl.com\/blog\/?p=1194"},"modified":"2026-04-02T09:26:28","modified_gmt":"2026-04-02T09:26:28","slug":"use-cordova-to-compile-html5-games-to-android-app","status":"publish","type":"post","link":"https:\/\/www.netexl.com\/blog\/use-cordova-to-compile-html5-games-to-android-app\/","title":{"rendered":"Use Cordova to compile HTML5 games to Android App"},"content":{"rendered":"\n<p>Install npm and cordova <\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/docs.npmjs.com\/downloading-and-installing-node-js-and-npm\" target=\"_blank\">https:\/\/docs.npmjs.com\/downloading-and-installing-node-js-and-npm<\/a><\/p>\n\n\n\n<p>It is also useful to insall nvm which is node version manager to manage different versions of node.js.<\/p>\n\n\n\n<p>For windows the installable can be downloaded from here<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/coreybutler\/nvm-windows\/releases\" target=\"_blank\">https:\/\/github.com\/coreybutler\/nvm-windows\/releases<\/a><\/p>\n\n\n\n<p>check version of node, npm and, cordova using the commands as following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node -v\nnpm -v\ncordova -v<\/code><\/pre>\n\n\n\n<p>Once nvm is installed it can be used to check for installed version of node by using the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nvm ls<\/code><\/pre>\n\n\n\n<p>On windows use following command to see available versions on node<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nvm ls available<\/code><\/pre>\n\n\n\n<p>If a higher version of node is available it can be installed by specifying the version as following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nvm install 17.4.0<\/code><\/pre>\n\n\n\n<p>Configure the system to use the installed version of node now<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nvm use 17.4.0<\/code><\/pre>\n\n\n\n<p>Cordova install and update<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- fresh install --\nnpm install -g cordova\n\n-- uninstall and install --\nnpm uninstall -g cordova\nnpm install -g cordova@10.0.0\n\n-- update to latest version --\nnpm update -g cordova<\/code><\/pre>\n\n\n\n<p>Update npm to the latest version by specifying the version number<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install -g npm@8.4.0<\/code><\/pre>\n\n\n\n<p>All of the above commands are specified to make sure that we have latest version of node, npm, nvm, cordova installed before we start creating packages for our HTML5 game. Version numbers are mentioned in the command as of the date this article was written. Make sure to check the latest version of all tools and change the version numbers accordingly.<\/p>\n\n\n\n<p>Open Node.js command prompt and run commands to create our app. Go to the folder where you would be creating the app.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cordova create myApp com.myCompany.myApp myApp\ncd myApp\ncordova plugin add cordova-plugin-camera --save\ncordova platform add android --save\ncordova requirements android\ncordova build android --verbose\ncordova run android<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install npm and cordova https:\/\/docs.npmjs.com\/downloading-and-installing-node-js-and-npm It is also useful to insall nvm which is node version manager to manage different versions of node.js. For windows the installable can be downloaded from here https:\/\/github.com\/coreybutler\/nvm-windows\/releases check version of node, npm and, cordova using the commands as following Once nvm is installed it can be used to check for installed version of node by using the command On windows use following command to see available versions on node If a higher version of node is available it can be installed by specifying the version as following Configure the system to use the installed version of node now Cordova install and update Update npm to the latest version by specifying the version number All of the above commands are specified to make sure that we have latest version of node, npm, nvm, cordova installed before we start creating packages for our HTML5 game. Version[&#8230;]<\/p>\n","protected":false},"author":2,"featured_media":1540,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,28,14,3,19,34],"tags":[],"class_list":["post-1194","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-cordova","category-how-to","category-html5","category-mobile","category-useful"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/1194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/comments?post=1194"}],"version-history":[{"count":5,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/1194\/revisions"}],"predecessor-version":[{"id":1206,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/1194\/revisions\/1206"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/media\/1540"}],"wp:attachment":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/media?parent=1194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/categories?post=1194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/tags?post=1194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}