Aller au contenu

Cette page n'est pas encore traduite. Elle s'affiche en anglais.

Editors and agents

Code intelligence for Android projects through elide lsp (android.*, androidx.* and R), and the android/* tools elide mcp adds for agents.

Lire hors ligneelide help --lang fr android-editors

Sur cette page
Utiliser avec l’IA
Ouvrir dans ChatGPTOuvrir dans Claude

Language server

elide lsp resolves an Android project’s Java sources against the classpath elide install exports under .dev/dependencies/m2/. Run it once before starting the editor, and again after changing dependencies:

Terminal
bash
elide install

In an Android project the install also unpacks every .aar dependency and links the resources of every artifact, so the exported classpath carries:

FromResolves
The compileSdk platform’s android.jarandroid.*
Each .aar’s classes.jar, and plain jarsandroidx.*, Material, Play services, …
The generated R classesR.string.app_name, R.layout.main, …
The test and instrumented-test classpathsRobolectric, JUnit, AndroidX Test, Espresso

Go to definition on an R field opens the generated R.java at that identifier. When the SDK has the platform’s sources (sources;android-<N>), hover and go to definition on a framework type read them:

Terminal
bash
sdkmanager --install 'sources;android-36'
  • The server has one classpath for every file under its root, so a src/androidTest file also sees host-test libraries, a src/test file instrumented-test libraries, and a src/main import of a test-only library raises no diagnostic; the build keeps the scopes apart and reports it.
  • Definition on a JDK class reads the lib/src.zip of the JDK JAVA_HOME names; Elide does not ship one (Other editors).
  • A resource added after the install resolves once R is rebuilt, by elide build or elide install, and the server restarted.
  • No BuildConfig class exists to resolve: Elide does not generate one.
  • Kotlin sources are not served by elide lsp.

Editor setup: IDE integration, Other editors.

Compose previews

Debug builds compile Compose code with source information, so preview tooling can locate each composable call (Kotlin compiler). The template declares the ui-tooling module, which carries the activity a device-side Compose preview launches; keep tooling modules in debug artifacts.

Agents

elide mcp in a project whose elide.pkl declares android, or a workspace root with such a member, adds tools for driving the project. In any other project they are not listed.

ToolRunsMirrors
android/sdkNothing: reads the SDKelide project info
android/sdk/installandroid-sdk, installingelide install --accept-android-licenses
android/devicesNothing: asks adb and avdmanagerelide project info
android/avdandroid-avdelide build android-avd
android/emulator/startandroid-emulator, headless by defaultelide build android-emulator
android/emulator/stopandroid-emulator-stopelide build android-emulator-stop
android/runandroid-run[-emulator]-<app> --no-followelide run
android/testandroid-test-<app>[-on-<device>]elide test --device
android/test/hostThe host testselide test
  • Each tool runs the build target its command runs, chosen by the same rules, so the two never disagree.
  • Nothing is installed unless the call passes acceptLicenses: true. android/sdk/install requires it; a license recorded in the SDK does not stand in for it.
  • android/run returns once the app has launched, with the device, package and activity, whether the app is still running after logWaitMs (default 2000, at most 30000), and the last logLines lines of its log (default 200, at most 2000), or of the crash buffer if the app has died.
  • android/test returns each device’s totals, whether the run finished, and every test’s outcome with a failure’s stack trace; android/test/host every host test’s status and failure message.
  • A failed build returns outcome: "failure" and up to 100 of the warnings and errors it reported. A request the project cannot satisfy (no application, several and none named, nothing instrumented) is a tool error naming what exists.

The android template’s MCP option writes a .mcp.json that registers elide mcp. Client setup and the other tools: Project MCP server.

Cette page vous a-t-elle aidé ?