Anticode Open builder

Build Android app from website: Android Studio sync, run, sign and bundle

The Android half of Anticode's app download is a Capacitor project that opens in Android Studio on Windows, macOS or Linux. Run two commands, open it, let Gradle sync and try it on an emulator. Then create your own upload key and generate a signed Android App Bundle, the .aab file Google Play asks for. The keys are yours alone; Anticode never sees them.

Updated · By the Anticode team

Open the project

When you build Android app from website content, Android Studio is where the signed file gets made; everything before that is preparation.

  1. Download the zip from the builder's App stores section, after setting your own app ID (a reversed domain you control) and the name under the icon.
  2. Unzip it, open a terminal in the folder, and run npm install, then npx cap sync. The zip leaves out the files Capacitor generates, such as its Gradle settings for plugins, and the sync creates them.
  3. Run npx cap open android, or open the android/ folder from Android Studio.
  4. Wait for Gradle to finish syncing before you touch anything. The first sync downloads a good deal.

Run it on an emulator

Capacitor's Android guide supports Android 7 (API 24) and later, and recommends an emulator image at API 24 or above; it also notes that the System WebView on emulators doesn't update itself, so use a recent image. Press Run. The app opens your live site full screen. Check three things:

  • The share button in the corner, in your accent colour, opens Android's share sheet with the page title and address.
  • Booking reminders: if the site has a booking form, book a slot more than an hour ahead and the thank-you page offers a reminder. Android asks for notification permission at that moment, and the notification uses a calendar-style icon tinted with your accent.
  • Offline: switch the emulator to aeroplane mode and you get the app's own offline screen, with a Try again link.

Both features come from SiteFeatures.java, a small local Capacitor plugin registered in MainActivity that injects one script into your site's pages, limited to your site's origin. On a WebView too old to support that injection, the features simply don't appear; the site still works.

Create your upload key

Android's app signing guide walks through this. In Android Studio:

  1. Choose Build > Generate Signed Bundle/APK, select Android App Bundle, then Next.
  2. Under Key store path, choose Create new.
  3. In New Key Store, give the .jks file a path and a password, then a key Alias, its password, a Validity (years) of at least 25, and your certificate details. Choose OK.
  4. Back in the dialog, continue with Next, choose the release build type and a destination folder, and Create.

Keep the keystore file and both passwords somewhere safe and backed up, away from the project folder and out of any Git repository.

Upload key and app signing key

The two keys in Play App Signing
Upload keyApp signing key
Who holds itYouGoogle, under Play App Signing
SignsThe bundle you uploadThe APKs installed on phones
If lostRequest an upload key reset in Play ConsoleNever changes during the app's life

Turn on Play App Signing when you create the first release; Anticode's checklist recommends it too. Android's guide warns that without it, losing your signing key means you can no longer publish updates. With it, a lost upload key is an inconvenience, not the end of the app.

Why a bundle, not an APK

Google Play has required new apps to be published as Android App Bundles since August 2021, as the App Bundle documentation states. The .aab is what you upload in Play Console; Google builds device-specific APKs from it.

Before every later upload

Open android/app/build.gradle and raise versionCode (a whole number Play uses to order releases) and versionName (what people see). Then generate a new signed bundle with the same upload key. Content changes to your site don't need any of this, because the app loads the live site; only changes to the app itself, such as its name or icon, do.

Already set in the project

  • applicationId and namespace set to your app ID, with MainActivity moved into that package.
  • app_name set to the name under the icon.
  • Launcher icons at five densities, round and adaptive versions with your accent as the background, and a splash screen built from your background colour.
  • The androidx.webkit dependency the features need.

Limits

  • Anticode doesn't build, sign or upload, and never holds your keystore or Google credentials.
  • No push notifications; they'd need your own Firebase project.
  • Screenshots are yours to take from the emulator.

Next: the Google Play submission steps. The full download is described on the Capacitor project page; the iOS side is in Xcode.

Questions people ask

Does Android Studio work on Windows?

Yes. Android Studio runs on Windows, macOS and Linux, unlike Xcode, which needs a Mac.

Can I use an APK instead?

For testing on your own phone, yes. For a new app on Google Play, upload an Android App Bundle.

What if I lose the upload key?

With Play App Signing on, create a new key and request an upload key reset in Play Console. Your app signing key is unaffected.

Sources

  1. Capacitor Docs: Android, checked
  2. Android Developers: Sign your app, checked
  3. Android Developers: About Android App Bundles, checked