Skip to content

v0.2.0

Latest

Choose a tag to compare

@rizukirr rizukirr released this 07 Oct 07:44
· 2 commits to main since this release
2fe5f13

This release makes android-cli the default wherever it can do the job, adds features from a running Android Studio, and simplifies the build and emulator commands. Five changes are breaking, so read the first section before you update.

Full changelog: v0.1.3...v0.2.0

Breaking changes

Java (jdtls) support is removed. droid covers Kotlin, Gradle and Android tooling only. It no longer starts jdtls or attaches a server to Java buffers. Old lsp.java keys in a config are ignored. Configure jdtls separately if you need it.

:DroidBuildVariant and :DroidInstall are removed. :DroidBuild and :DroidRun now ask for the variant themselves, from the project's real variants. The last pick is listed first, and a project with one variant is not asked.

:DroidEmulatorCreate and :DroidDevices are removed. :DroidEmulator does it all: start an emulator, or pick "+ Create New Emulator" or "- Delete Emulator".

:DroidRun no longer starts emulators. It needs a device or emulator that is already running. With none, it says so, points to :DroidEmulator, and stops before doing anything slow.

Two settings are removed. android.boot_complete_timeout_ms and android.boot_check_interval_ms only applied to :DroidRun waiting for an emulator it had started.

Update keymaps that call a removed command.

Features

Android Studio features, from Neovim. With Android Studio (Quail 2 or newer) running and the project open, :DroidLint shows Studio's inspections and Android Lint for the current file as diagnostics. :DroidDeclaration and :DroidUsages use Studio's index, which reaches across modules. :DroidVersions looks up the latest stable and preview versions of libraries, AGP, Kotlin and Compose. :DroidStudioOpen opens the current file in Studio. Each call starts the CLI, so it takes about two seconds.

New android-cli commands. :DroidCreate makes a new project from a template. :DroidSdk lists, installs, updates and removes SDK packages. :DroidLayout shows the UI tree of a device's screen as JSON, and :DroidLayout! includes hidden elements.

Delete an emulator. The :DroidEmulator picker has a "- Delete Emulator" entry. It asks which one, then asks to confirm with "No" first.

Progress you can see. Every Gradle run, including variant discovery, runs in the droid panel. So do emulator creation and the android-cli install and launch. Closing the panel leaves the task running, and the panel opens again if the task fails.

:checkhealth droid covers everything. It reports the Neovim version, the Gradle wrapper, how Gradle finds the SDK, the applicationId, android-cli and the SDK it uses, whether Android Studio is reachable, the SDK tools, running devices and where each language server was found, with advice for each problem.

One SDK everywhere. droid passes the SDK it detected to every android-cli call, and to Gradle when the environment sets no ANDROID_HOME. A project without local.properties no longer stops at "SDK location not found".

Logcat follows the app. When the app restarts or crashes, logcat switches to its new process and keeps the lines already shown. It scrolls along only while the cursor is on the last line, so you can read back while it streams.

:DroidRun is one Gradle run. It runs install<Variant> alone, which assembles first, and it picks the applicationId of the variant you chose, including flavor suffixes.

Language servers install on request. A missing server is offered through Mason once per session instead of installed silently, and starts when the install finishes.

Fixes

android-cli 1.0 compatibility. android emulator create takes the profile as an argument, not --profile=. android docs search results are parsed into titles and URLs instead of listing every output line. The CLI exits 0 for several failures ("AVD already exists", "Device x doesn't exist", an unknown SDK package), so droid checks the result itself before reporting success. The CLI's update notice is no longer read as emulator names.

Logcat. grep= now filters, on plain text. Lines split across output chunks are joined. A restarted session stays stoppable. :DroidLogcatFilter re-filters the running session instead of asking for a device again, and it no longer kills a running build.

Gradle. :DroidTask passes extra arguments to gradlew separately. A gradlew without its executable bit runs through sh instead of being chmodded. The variant list refreshes when a build script is saved. A failing command no longer leaves every other command blocked.

Emulators and devices. Installing after starting an emulator no longer goes to a connected phone. An emulator that is already running is reused. android_avd_home applies to listing and starting. A launch falls back to monkey when no launcher activity resolves. Listing devices, finding the app's process and launching no longer block the editor.

Language servers. A first start that finds no server now retries on the next file. Folding applies only to droid's servers and survives other clients detaching. Decompiling jar:// and jrt:// uses the running Kotlin server. :DroidHintsToggle no longer brings back diagnostics from a stopped client. :DroidRenameFile leaves files with unsaved edits alone. A project's .droid-lsp.lua runs only after Neovim's trust prompt.

Kotlin editing. :DroidKdoc handles extension functions, type parameters and function-typed parameters.

Known limitations

The Android Studio commands need Studio running with the project open. With XDG_CONFIG_HOME set, Studio and android-cli use different settings folders. droid handles that by pointing the CLI at Studio's folder, where the CLI installs a second copy of itself (about 160 MB).

Rendering Compose previews through Studio is not included: Studio only renders after a build it ran itself.

Not yet run against real devices or installs: deleting an emulator, :DroidSdk install, update and remove, and :DroidStudioOpen. They pass tests against a stand-in CLI. :DroidSync runs gradlew --refresh-dependencies with no task, which may refresh only build-script dependencies.