This adds a native Android app that reuses the renderer/ UI. No TypeScript required.
- Node.js 18+ (recommended 20)
- Android Studio (SDK + platform tools)
- Java 17 (Temurin/OpenJDK)
- USB debugging enabled on device (or use an emulator)
-
Install Node deps:
npm ci -
Install Capacitor runtime + plugins (JavaScript):
npm i @capacitor/core @capacitor/android @capacitor/browser @capacitor/filesystem @capacitor/share @capacitor/app npm i -D @capacitor/cli -
Add Android platform:
npx cap add android -
Sync web assets:
npx cap sync android
If your renderer entry file is not
renderer/index.html, updatewebDirincapacitor.config.jsaccordingly.
-
Ensure the renderer does not call Electron APIs directly. Use
src/platform.js:Platform.openExternal(url)Platform.saveImageFromUrl(url, filename)Platform.share({...})Platform.getVersion()
-
To run on a device/emulator:
npx cap open androidThen click “Run” in Android Studio.
-
If you change files under
renderer/, re-sync:npx cap sync android
-
Debug APK:
(cd android && ./gradlew assembleDebug)Output:
android/app/build/outputs/apk/debug/*.apk -
Release AAB for Play Store:
- Create/upload a keystore and configure signing in Gradle or pass vars from CI.
- Build:
Output:
(cd android && ./gradlew bundleRelease)android/app/build/outputs/bundle/release/*.aab
- INTERNET is included by default.
- Image saving uses scoped storage via
@capacitor/filesystemtoPictures/StreamBooru/. - For some Android versions, call
ensureStoragePermission()before saving if you hit permission errors.
- See
.github/workflows/android.yml. - Tag a release (
vX.Y.Z) to produce artifacts, or run manually via “Run workflow”.
- Blank screen:
- Run
npx cap sync androidafter changingrenderer/ - Check console (Logcat) for CSP or network errors
- Run
- Mixed content (HTTP):
- Prefer HTTPS. If you must allow HTTP, configure network security in the Android project.
- Electron-specific code:
- Replace direct IPC or
requirecalls in the renderer withPlatform.*or guard withPlatform.isElectron().
- Replace direct IPC or