38691154c8
- Next static export (output: export) wrapped by Capacitor; appId com.bargevasat.app, appName «برگ وسط» - android/ native project + @capacitor/app; hardware back handled by CapacitorBack (back a screen, exit at home) - npm scripts (cap:sync, android:open, android:apk), ANDROID.md - Gradle Maven-mirror init-script template (dl.google.com/Maven Central are blocked in Iran — same reason NuGet is mirrored) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1.9 KiB
1.9 KiB
برگ وسط — Android (Capacitor) build
The app is packaged with Capacitor for Cafe Bazaar / Myket.
Layout
next.config.ts→output: "export"(static site inout/)capacitor.config.ts→ appIdcom.bargevasat.app, appName «برگ وسط», webDiroutandroid/→ generated native project (committed; build outputs are git-ignored)- Hardware back button handled by
src/components/CapacitorBack.tsx(@capacitor/app)
Build the web + sync native
npm run cap:sync # next build (export) + cap sync android
Build the APK
npm run android:apk # → android/app/build/outputs/apk/debug/app-debug.apk
# or open in Android Studio:
npm run android:open
Point the app at the live server at build time:
NEXT_PUBLIC_USE_SERVER=1 NEXT_PUBLIC_SERVER_URL=https://api.example.com npm run cap:sync
⚠️ Maven mirror required (Iran)
Gradle pulls the Android Gradle Plugin from dl.google.com and Maven Central,
which are blocked in Iran — exactly like nuget.org. Provide a Maven/Gradle mirror
(your Nexus maven-public group that proxies Maven Central and Google's
android repo), then build with the init script:
cd android
gradlew.bat assembleDebug --init-script gradle-mirror.init.gradle
Copy android/gradle-mirror.init.gradle.example → android/gradle-mirror.init.gradle
and set your mirror URL(s). (Kept out of git; machine-specific.)
Release (Cafe Bazaar / Myket)
- Generate a keystore:
keytool -genkey -v -keystore bargevasat.keystore -alias bargevasat -keyalg RSA -keysize 2048 -validity 10000 - Configure signing in
android/app/build.gradle(releasesigningConfig). gradlew.bat assembleRelease(orbundleReleasefor AAB) → upload to Cafe Bazaar / Myket.- App icon/splash: replace
android/app/src/main/res/**(use@capacitor/assetsto generate).