To convert a React app to an APK, set the build to relative paths (base: './' in Vite or "homepage": "." in Create React App), use HashRouter instead of BrowserRouter, run the production build, and zip the dist or build folder with index.html at the root. Upload the ZIP to an HTML 2 APK builder and the React app runs offline inside a native WebView.
- React SPAs built with Vite or Create React App
- Vue, Svelte, Solid, Preact and Angular builds — same recipe
- Dashboards and tools that call your API
- Internal apps you want on staff phones
Relative build paths
// Vite (React, Vue, Svelte, Solid, Preact)
export default defineConfig({ base: './' })
// Create React App — package.json
"homepage": "."
// Angular
ng build --base-href ./
// Vue CLI — vue.config.js
module.exports = { publicPath: '' }Routing: use hash URLs
A packaged app is a folder of files, not a server. BrowserRouter pushes paths like /settings; on reload or a deep link the app looks for a file called settings, finds nothing, and shows a blank page. HashRouter keeps the route after the # — index.html#/settings — so there is always a file to load.
import { HashRouter, Routes, Route } from 'react-router-dom';
root.render(
<HashRouter>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/settings" element={<Settings />} />
</Routes>
</HashRouter>
);Vue Router: createWebHashHistory(). Angular: withHashLocation(). SvelteKit: use adapter-static with hash routing, or a single-page fallback.
Calling your API
fetch() works to any https API. The page's origin inside the app is https://appassets.androidplatform.net, so add it to your server's CORS allow-list. Prefer token auth in a header over cookies: third-party cookies with SameSite rules often fail inside WebViews. Google Sign-In's redirect flow is blocked in WebViews (disallowed_useragent) — use email links, passkeys on your own domain, or a native app if Google login is essential.
Next.js, Remix and server rendering
Server-rendered apps need a server, so they cannot be zipped. Either export a static build (output: 'export' in Next.js, which works if you avoid server-only features) or deploy the site and convert its URL with the website URL to app route, which loads the live site and updates without rebuilding.
React to APK — questions
Do I need React Native to make an Android app from React?
No. React Native is a different framework that renders native views. A packaged React web build runs your existing code in Android's WebView, which is the right choice when you already have a working web app.
Why is my React APK blank?
Usually absolute asset paths or BrowserRouter. Set base: './' (or homepage: '.'), switch to HashRouter, rebuild and re-zip.
Does it work with Vue, Svelte and Angular?
Yes — any framework whose production build is static HTML, CSS and JavaScript. Set relative paths and hash-based routing in the same way.
Can my React app work offline?
The app shell always works offline because it is bundled. Data from your API needs a connection; cache the last response in IndexedDB so screens still show something offline.