Файли
openidea/plugins/official/android-devices/README.md
T
Alexandro Trevisanтаl0ng-ai 579ce3f731 feat(run): choose the run device from plugin device providers (#7822)
* feat(run): choose the run device from plugin device providers

Plugins can declare device providers (`[[contributes.devices]]`): a program
that lists simulators, emulators or phones as JSON, the run configurations
it applies to, and how a chosen device reaches the run (extra arguments,
environment, an optional prepare step that boots it). The title bar shows a
device chooser for the selected configuration; Run and Debug prepare the
chosen device first. Before-launch and build-on-update runs skip the device.

* feat(plugins): document run devices and require plugin API 1.21

`[[contributes.devices]]` now needs `engines.openidea = "^1.21"` and uses
camelCase fields (`appliesTo`, `runArgs`) like the other run contribution
points. The plugin README, the manifest reference and the API versions page
(en/zh) describe it, and `plugins/official/android-devices` is a small
example that lists the devices adb sees for Gradle install tasks.

* fix(plugins): harden device runner process handling, guard refresh races, verbatim headers, and add en.json entries

* fix(plugins): use portable process:sh capability in android-devices example and README

---------

Co-authored-by: l0ng-ai <[email protected]>
2026-12-05 09:34:41 +08:00

29 рядки
1.2 KiB
Markdown
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
# android-devices — API 1.21 example
A device provider (`[[contributes.devices]]`): the title bar shows a device
chooser next to Gradle run configurations that install the app or run connected
tests (`./gradlew :app:installDebug`), and the chosen device reaches the run as
`ANDROID_SERIAL`, which adb and the Android Gradle plugin's install tasks honour.
```
android-devices/
├─ plugin.toml # manifest: the provider and the process:sh capability
└─ devices/
└─ list.sh # prints `adb devices -l` as the JSON array the IDE reads
```
It is data only: no code, no WebAssembly, no build step. `adb` must be on PATH
(Android SDK platform tools). Connected emulators and phones are listed;
offline and unauthorized ones are not.
Install the folder through Settings › Plugins › Install from Disk and allow
`process:sh`. Check it from the repository root:
```sh
cargo run -p ide-host --bin openidea-plugin -- check plugins/official/android-devices
```
To boot an emulator before the run, add a `prepare` command that starts it and
prints the serial to use. The fields are described in the
[plugin guide](../../README.md#run-devices-api-121).