fix(android): skip sync on cap run after restore-local-plugins

`npx cap run android` runs `sync` by default, which regenerated
`capacitor.plugins.json` and removed SafeArea and SharedImage entries
after `restore-local-plugins.js` had already run. Use `--no-sync` in
`build-android.sh` (auto-run) and `auto-run.sh` so the launch step does
not overwrite the restored plugin list.
This commit is contained in:
Jose Olarte III
2026-03-26 15:50:35 +08:00
parent aaee3bbbd2
commit 0ebad3b497
2 changed files with 5 additions and 3 deletions

View File

@@ -204,7 +204,7 @@ run_android() {
safe_execute "Launching app" "adb -s $device_id shell am start -n app.timesafari.app/app.timesafari.MainActivity"
else
log_info "Launching emulator and installing app"
safe_execute "Launching app" "npx cap run android"
safe_execute "Launching app" "npx cap run android --no-sync"
fi
}

View File

@@ -645,11 +645,13 @@ if [ "$BUILD_AAB" = true ]; then
fi
# Step 11: Auto-run app if requested
# cap run runs sync by default, which would overwrite capacitor.plugins.json again;
# we already synced and ran restore-local-plugins.js above, so skip sync here.
if [ "$AUTO_RUN" = true ]; then
log_step "Auto-running Android app..."
safe_execute "Launching app" "npx cap run android" || {
safe_execute "Launching app" "npx cap run android --no-sync" || {
log_error "Failed to launch Android app"
log_info "You can manually run with: npx cap run android"
log_info "You can manually run with: npx cap run android --no-sync"
exit 9
}
log_success "Android app launched successfully!"