Free HTML to APK
← All articles AI · Debugging

Fixing AI-written code: 8 mistakes we see in phone apps

AI writes most of the app, then a few small problems make it feel broken on a phone. Here are the usual suspects and the exact fixes.

9 October 2026 · 2 min read

AI models are surprisingly good at writing small apps. They are also confidently wrong in the same handful of ways, again and again. Once you know these, you can spot them in seconds and tell the AI exactly what to change.

1. It loads things from the internet

A script from a CDN, a Google Font, a stock photo by URL. It all works until the phone is offline. Ask: "Remove all external resources. Inline the CSS and JavaScript and use system fonts."

2. It calls the native bridge too early

The app's native bridge, window.FreeApp, can arrive a moment after your script starts. Code that calls it on the first line sometimes fails. The fix is to wait for the freeappready event, or run immediately if the bridge is already there:

function start() { FreeApp.statusBar('#E2552A'); }
if (window.FreeApp) start();
else window.addEventListener('freeappready', start, { once: true });

3. It forgets to save

Everything works, then you close the app and the data is gone. Ask: "Save the state to localStorage after every change and load it on start."

4. It uses alert() for everything

Browser alerts look out of place in an app. Ask the AI to show messages in the page, or use FreeApp.toast() when the bridge is available.

5. Buttons are too small

Desktop sizes leave you tapping three times to hit a button. "Make every tap target at least 44 pixels" fixes it.

6. It ignores the notch

Headers slide under the status bar or the camera cutout. Add viewport-fit=cover to the viewport tag and pad the top with env(safe-area-inset-top).

7. It mixes up file names

When the AI splits code into several files, it sometimes links to styles.css but names the file style.css. If your app shows unstyled text, compare the names. Asking for a single file avoids the problem entirely.

8. It invents functions

Models sometimes call native functions that do not exist. If something silently does nothing, check the name against the JavaScript API reference, then paste the correct signature into the chat.

How to ask for a fix

Be specific and give context. "On Android, when I tap Save, nothing happens and the list is empty after I reopen the app" gets a far better answer than "it doesn't work". If you can, paste the part of the code you think is wrong. Small, focused fixes beat asking for a full rewrite.

Try it yourself. Free HTML to APK turns your HTML into a signed Android app right on your phone. Free, no account, no watermark.