Live Talk: Supercharge your existing CI/CD pipelines with Ionic Appflow
Working with Capacitor involves several key additions to your workflow.
Capacitor turns your web app into a native binary for each platform. Thus, much of your work will consist of developing and then building a mobile-focused web app.
npm run build.
You may wish to sync your web app with your native project(s) in the following circumstances:
To sync your project, run:
npx cap sync
If you get an error about not being able to find the web assets directory, you may need to configure
webDirin the Capacitor configuration.
There are a few ways to deploy your project on native devices, depending on your use case. Most common is on the command-line with
npx cap run.
After you build your web assets (e.g. with
npm run build) and copy them into your native project(s) with
npx cap sync, you are ready to build a native binary.
Capacitor does not have a “build” command. After
sync, you are encouraged to open your target platform’s IDE for building your native app.
For building your app on the command-line or in CI environments, you are encouraged to use your target platform’s tooling: Gradle for Android and
xcodebuild for iOS. Third-party tools such as
Fastlane may make this easier. Cloud builds and more are available when using
You may wish to open your project in a Native IDE (e.g. Xcode and Android Studio) in the following circumstances:
To update Capacitor Core and CLI:
npm install @capacitor/cli npm install @capacitor/core
To update any or all of the platforms you are using:
npm install @capacitor/ios npm install @capacitor/android
You can subscribe to the Capacitor repo to be notified of new releases. At the top of the repository index, click Watch -> Releases only.
Need to tie into the capacitor cli command events? Check out the hooks here.