๐ฑ Guide
How to Convert an HTML5 Game to an Android APK (with AdMob)
Step-by-step: turn an HTML5 game into an Android APK and Play Store AAB, keep it offline, and connect AdMob interstitial and rewarded ads.
Updated 2026-10-11 ยท by HTML Games Code
Short answer
To turn an HTML5 game into an Android app, put the game's files inside an Android WebView app, load index.html from the app's own files so it works offline, enable fullscreen and audio, and build a signed APK (for testing) and AAB (for Google Play). To earn money, connect AdMob to the game through a small JavaScript bridge.
If you would rather skip the setup, our HTML Games APK Builder service does all of this for any of our games: the Android build is included with the code for $19, and extra builds are $1.
1. Make sure the game runs offline
Android apps should not depend on a server or CDN for the game itself. Check that the game has no external scripts or Google Fonts links, that fonts are bundled, and that it runs from a local static server. All HTML Games Code templates already meet this: zero dependencies, bundled fonts and synthesized audio.
2. Wrap it in a WebView app
Your options:
- Android Studio + WebView: a single activity with a WebView that loads
file:///android_asset/game/index.html(or a local loopback server for ES modules). Full control, free, but needs Android knowledge. - Capacitor / Cordova: web-app wrappers with plugin ecosystems. Good if you are a web developer.
- An APK builder service: upload the files and get an APK/AAB back. Fastest, no coding.
Whichever you choose, enable JavaScript, DOM storage (for saves), media playback without a user gesture, and immersive fullscreen.
3. Handle the back button and app lifecycle
Map the Android back button to the game's pause or home screen instead of closing the app, and pause audio when the app goes to the background. Our games already pause on visibilitychange and save progress automatically.
4. Connect AdMob
Games call two functions: Ads.showInterstitial() and Ads.showRewarded(). On Android, the WebView exposes a native object named GameAdsBridge that shows the AdMob ad and then calls back into JavaScript:
// native side shows the ad, then calls:
window.onAdClosed(); // after an interstitial
window.onRewardedResult(true); // reward the player (false = skipped)See how to add AdMob to an HTML5 game for the full flow.
5. Build, sign and publish
Generate a release keystore (keep it safe, since you need it for every update), build a signed AAB, and upload it to the Google Play Console with your store listing, screenshots, privacy policy and content rating. Test the APK on a real device first, including rewarded ads with AdMob test IDs.