Skip to main content

Run the NPX commands to update the app

npm run build && npx cap sync

Run app with live reload

ionic cap run {platform} -l --external

Replace {platform} with Android or iOS depending on your environment as follows

Android android
iOS ios

To open in Android

ionic cap run android -l --external

You'll be prompted to select a emulator (depending what you have loaded)

? Which device would you like to target?
  Pixel 3 API 31 (emulator) (Pixel_3_API_31)
  Pixel 5 API 27 (emulator) (Pixel_5_API_27)
  Pixel 5 API 30 (emulator) (Pixel_5_API_30)
  Pixel 5 API 31 (emulator) (Pixel_5_API_31)
❯ Pixel 5 API 33 (emulator) (Pixel_5_API_33)


Generate a release APK without opening Android Studio

ionic capacitor copy android --prod && cd android && ./gradlew assembleRelease && cd ..

Generate a debug APK without opening Android Studio

ionic capacitor copy android && cd android && ./gradlew assembleDebug && cd ..

Generate icons & splash screen in a top-level resources folder within your project, like so:

   ├── icon.png
   └── splash.png

Run the following command:

cordova-res ios --skip-config --copy
cordova-res android --skip-config --copy

Or without specifying the platform:

cordova-res --skip-config --copy

How to build and run APK directly on the device from CLI

ionic capacitor copy android && cd android && ./gradlew assembleDebug && ./gradlew installDebug && cd ..

Open app using Android Studio or Xcode

npx cap open {platform}

As per notes earlier, replace {platform} with the respective environment you are targeting.  So to open in Android Studio

npx cap open android


Related articles

Andrew Fletcher16 Aug 2022

How to handle a lost KeyStore password in Android?

If you have a situation where either you have forgotten a Keystore password or change of developers and the password wasn't sent across.... what to do?  However, your app lives on and needs to be updated!   Possible solutions This is a great starting point....
Andrew Fletcher08 Aug 2022

How to update package.json dependencies to the latest version?

This article works through the steps to update dependencies in package.json file to the latest version. Use npm-check-updates or npm outdated to suggest the latest versions. npm-check-updates is a utility that automatically adjusts a package.json with the latest version of all...