简体   繁体   中英

Run Ionic 5 app on real android device using capacitor

I've recently started working with capacitor using using ionic 5. I've read all the capacitor documentation but I didn't find any guidance that how can I run Ionic 5 app on real android device. Can anyone guide me how can run Ionic 5 app on real android device? Thanks.

Capacitor apps are run from Android Studio directly

If you already have an Ionic project with Capacitor integrated, just run npx cap open to open Android Studio, and with a device plugged, do Run -> Run 'app' or click the green triangle button.

You can run ionic 5 on real android device with command:

$ ionic capacitor run android --target [device-id]

To get real android device-id, you can run this command:

$ adb devices

Example:

$ adb device
List of devices attached
05fca57a7d29    device

$ ionic capacitor run android --target 05fca57a7d29
> ng run app:build
✔ Browser application bundle generation complete.
✔ Copying assets complete.
✔ Index html generation complete.
...

You can execute the following command to run the app directly into the device.

What it will do is it will detect the connected device and ask you to select which device you want to run.

ionic capacitor run android --device

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM