Skip to content

Conversation

@theproducer
Copy link
Contributor

@theproducer theproducer commented Oct 28, 2025

This PR adds a --target-name flag to cap run ios|android to select a run target by name instead of its ID.

example:

npx cap run ios --target-name "iPhone 17 Pro"

Its up to the developer to make sure their emulators / simulators have unique names.

To target emulators / simulators with similar names but different OS versions:

npx cap run ios --target-name "iPhone 16 Pro" --target-name-sdk-version "18.0"

closes: #8111

Copy link
Contributor

@OS-pedrogustavobilro OS-pedrogustavobilro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, working for iOS, but I'm getting this problem when I try to use this with an Android device.

If I run npx cap run android I get the device as an option, and can select it to run a build - but once I provide it npx cap run android --target-name <targetName>, the command fails, seems it can't find that target name, and undefined appears as an option instead of the actual device name. For emulators it seems fine.

[error] Invalid target name: HMD Global Nokia 5.3.
        Valid targets are: undefined [...], ...

Is there any difference between the device names showing up as options in npx cap run and the ones used to filter for target-name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: cap run --target-name for team usage

5 participants