Use Cordova to compile HTML5 games to Android App

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[…]

Quick Tip

How to choose a category when submitting app in Samsung seller office

If you are trying to upload an APK to Samsung seller office and you are seeing two categories as following Main Category Galaxy Specials If you leave it to Main Category, it won’t let you submit the APK for approval. If you select “Galaxy Specials” then you may get following error The registered binaries do not meet the category conditions for GALAXY Specials. The GALAXY Specials category can be selected only if at least one binary supports GALAXY Specials. You can go to ‘Binary>Advanced Mode>Binary Details’ to check the supported GALAXY Specials options. If you are trying to upload the saem APK which you uploaded to Google Play store, it will not work. Simply add following line to your manifest.xml and and build APK again. <uses-permission android:name=”com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY” /> Now you can simply select “Galaxy Specials” as the category and submit your app.

Quick Tip

Remote debugging HTML5 games on Android using Chrome DevTools

Steps – Enable your Android device for debugging. For this go to settings on your mobile device -> Developer Options -> Enable USB debugging Now go to your PC/Mac and launch Chrome browser. Open DevTools by hitting F12. In DevTools open Remote Devices. Make sure you have “Discover USB devices” option checked here. Alternatively, simply type chrome://inspect/#devices in the chrome browser Now connect your mobile device to Mac/PC using USB cable. You should now see you device listed under devices section Now go to your mobile device and open the app your are trying to debug. Once app is running in mobile, go back to chrome browser on your Mac/PC and click on the device name to see all running browser as well as webview instances on your mobile. Simply click on “Inspect” button to luanch chrome tab for your app. You can continue to browser your app on mobile[…]

WebGL: INVALID_VALUE: vertexAttribPointer: index out of range

I tried to update a game which was using last official relase of Phaser CE 2.6.2 compiled with cordova to the latest version (2.12.0) and started seeing below error in some mobile devices WebGL: INVALID_VALUE: vertexAttribPointer: index out of range There were hundreds were such errors logged and webview declined to log any further errors. Reverting it back to 2.6.2 fixes the problem. Looked for fixes in Phaser forums but did not find anything of help so reverted it back to 2.6.2. Seems like its going to be like that until we get regressively tested newer CE versions available.

“App not Installed” Error on Android When Updating to Newer Version

I recently updated an old Cordova Android app and tried to install it on my Android phone which had previous version installed already and the install failed with the message “App Not Installed”. Other than updating Android version and couple of plugins, everything else was same old and I had correctly changed “android-versionCode” as well as “version” to higher number so nothing looked wrong but I suspected it had something to do with either the version code or the certificates I was using to sign the app so I decided to look into the previous APK file and try to find something out. We can use AAPT tool to look into APK files which can be found in build-tools\<buildToolVersion> folder (for ex, C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.1). Go to the folder and run following command in the command prompt aapt dump badging myapp.apk It turned out that though I had android-versionCode code[…]

Quick Tip

Use Standalone Visual Studio Emulator for testing Android Apps

Microsoft is now providing Visual Studio Emulator for Android which can be used to deploy, test and debug Android apps. It also comes with a standalone version which can be used for quickly testing your APK files without needing Visual Studio which is very helpful for hybrid apps which are not built using standard development tools. For example if you have built your app using cordova and are looking for testing your app on a few emulators and are short of actual physical devices then this emulator comes handy which currently has support up to Marshmallow (API level 23). Download the standalone emulator installer from https://aka.ms/vscomemudownload Click on the installer and go through the installation process. It uses Hyper-V for running the emulator so it may ask you to confirm on activating it. Once it is installed you can open the emulator by searching for “Visual Studio Emulator for Android” in your windows[…]

Cordova Error: Android SDK not found. Make sure that it is installed

I recently tried to upgrade Cordova app which was last compiled almost an year back and got the following error Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable. I turns out that I had updated Android SDK version on my PC during that time and all I needed to do was to update the platform version in the app as well. Using Node.js Command Prompt and cordova commands, check the installed platform in the app using the following command cordova platform version android Update the installed platform version in the app using the following command cordova platform update android While upgrading the app additional issues I faced were related to plugins not being compatible with the new platform version which were fixed by simply removing the plugins and re-adding it which in some cases[…]

Error: An invalid APK was received. Not a signed jar file.

When I tried to upload APK file to Aptoide store which was built using cordova and signed for the release version, I got this error An invalid APK was received, does not seem to have all files correctly signed. Please verify apk signature and try again. Signature error: Not a signed jar file The same APK was fine when uploaded on Google Play Store. In order to fix this problem I had to create an unsigned release version of the APK using cordova and then sign it using jarsigner utility. In order to create unsigned release version of the APK, following command can be used cordova build android –release Jarsigner utility comes with java sdk and can be found @ your JDK bin folder (for ex, C:\Program Files\Java\jdk1.8.0_131\bin). The command which can be used to sign the APK is as following jarsigner -verbose -tsa http://timestamp.comodoca.com -keystore android.keystore -storepass password mygame.apk alias[…]

Making of a Responsive Mobile Game App using Phaser: FPS Problem

In the previous articles (Intoduction, Calculation, Game Screen) we went through the basic steps required for mobile game creation and looked at calculating and adding responsive behaviour to our game. The same concept applies to the game screen as well. Here is the main game screen The game is a classic dominoes game where players are required to throw their dominoes on their personal train or a special public train, or any other player’s personal train when it becomes public during the play. A lot of tweeing effects are used in the game which is turning out to be the main area to focus. The first step to optimize the game was to reduce the resolution for mobile which I chose to be 960×640 for devices with low processing power and 1350×900 for devices with high processing power. In order to do some benchmarking I integrated some code to measure FPS in[…]