With www/ built, add the platform. cap add copies the build in and finds the three plugins:
npx cap add android✔ Adding native android project in android in 125.17ms
...
[info] Found 3 Capacitor plugins for android:
@capacitor/app@8.1.1
@capacitor/camera@8.2.4
@capacitor/geolocation@8.2.2
...
[success] android platform added!The new android/ folder is source code from now on (Committing android/ and ios/); commit it with the branch. Two edits follow. The Geolocation plugin declares no permissions of its own (Geolocation), so they go into android/app/src/main/AndroidManifest.xml after the template's INTERNET permission:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />The Camera plugin needs no manifest entry, because it asks the system camera app to take the picture (Camera). The second edit is the service-worker guard of Adding Capacitor. Then build the web app, sync, and run Gradle 19,597 with JDK 21, which Capacitor 8 243,123 's Android library requires (Android Studio and SDK):
npm run build
npx cap sync android
cd android
JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ./gradlew assembleDebug... [info] Sync finished in 0.191s ... BUILD SUCCESSFUL in 53s 188 actionable tasks: 188 executed
With Gradle's cache already warm, the first build took 53 seconds and produced a 9.8 MB debug APK, targeting API 36 with a minimum of 24 (variables.gradle).