1. Home
  2. Docs
  3. Android Studio method

Docs

Convert a website to APK in Android Studio (Kotlin WebView code)

Prefer to own every line? This is the developer route: a complete, modern WebView app in Kotlin that you build and sign in Android Studio. Budget an afternoon if you've never used Android Studio before.

Updated 2026-10-213 min readBy the Web to App Creator team
Short answerCreate an Empty Views Activity project in Android Studio, add the INTERNET permission, put a full-screen WebView in MainActivity.kt with JavaScript and DOM storage on, handle the back button and external links, then use Build → Generate Signed App Bundle / APK. Or skip all of it: the free converter builds the same app in five minutes.

1. Create the project

Install Android Studio, then File → New → New Project → Empty Views Activity. Choose Kotlin and a minimum SDK of 24 (Android 7.0) — that covers well over 95% of active devices. Set the package name now; it's permanent once you publish (try the code generator to pick one).

2. AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:label="My App"
    android:icon="@mipmap/ic_launcher"
    android:theme="@style/Theme.Material3.DayNight.NoActionBar">
    <activity
        android:name=".MainActivity"
        android:exported="true"
        android:configChanges="orientation|screenSize|keyboardHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

configChanges stops Android from reloading the page when the phone rotates.

3. MainActivity.kt

class MainActivity : AppCompatActivity() {
    private lateinit var web: WebView
    private val home = "https://example.com/"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        web = WebView(this)
        setContentView(web)

        web.settings.apply {
            javaScriptEnabled = true
            domStorageEnabled = true          // localStorage, needed by most sites
            loadWithOverviewMode = true
            useWideViewPort = true
        }
        web.webViewClient = object : WebViewClient() {
            override fun shouldOverrideUrlLoading(v: WebView, r: WebResourceRequest): Boolean {
                val url = r.url
                if (url.host == Uri.parse(home).host) return false   // stay in the app
                startActivity(Intent(Intent.ACTION_VIEW, url))       // tel:, mailto:, other sites
                return true
            }
        }
        onBackPressedDispatcher.addCallback(this) {
            if (web.canGoBack()) web.goBack() else finish()
        }
        if (savedInstanceState == null) web.loadUrl(home) else web.restoreState(savedInstanceState)
    }

    override fun onSaveInstanceState(out: Bundle) {
        super.onSaveInstanceState(out)
        web.saveState(out)
    }
}

Wrap startActivity in a try/catch for ActivityNotFoundException if you link to schemes the phone might not handle.

4. File uploads, camera and downloads

A WebView ignores <input type="file"> until you implement WebChromeClient.onShowFileChooser and return the picked file through the callback — use registerForActivityResult(ActivityResultContracts.GetMultipleContents()). Downloads need a DownloadListener that hands the URL to DownloadManager. Geolocation needs onGeolocationPermissionsShowPrompt plus the runtime location permission. This is the part that usually takes longest — and it's all built into the no-code converter.

5. Bundle files instead of a URL (optional)

Put your site in app/src/main/assets/www/ and serve it with WebViewAssetLoader so it loads from https://appassets.androidplatform.net/assets/www/index.html. Avoid file:// URLs — ES modules and fetch are blocked there.

6. Sign and build

  1. Build → Generate Signed App Bundle / APK.
  2. Choose Android App Bundle for Google Play or APK to share directly.
  3. Create a new keystore. Back it up — lose it and you can't ship updates (unless you use Play App Signing).
  4. Pick the release build variant and finish. The file lands in app/release/.

DIY vs converter

Android StudioWeb to App Creator
Time to first APK2–6 hoursAbout 5 minutes
Needs a computerYes (8 GB+ RAM)No
Uploads, camera, downloads, offline screenWrite it yourselfBuilt in
Full code controlYesSettings only
CostFreeFree APK · $5/mo for AAB

Create your app now — free

No watermark, no card, no Android Studio. Pick what you're starting from:

Frequently asked questions

How do I convert a website to APK in Android Studio?

Create an Empty Views Activity project, add the INTERNET permission, load your URL in a WebView with JavaScript and DOM storage enabled, handle the back button, then generate a signed APK or App Bundle.

Is WebView code allowed on Google Play?

Yes. Make sure the app adds value, targets a current API level and doesn't load other people's content.

Why do file uploads not work in my WebView app?

WebView doesn't open a file picker by itself. Implement WebChromeClient.onShowFileChooser and pass the selected file back through the callback.

Should I use Java or Kotlin?

Kotlin is Google's recommended language for new Android apps, and every example in the docs uses it. The WebView API is the same in both.

Can I get this code without writing it?

Yes — the WebView app code generator fills in your URL, package name and options and gives you copy-ready files.