Connect Android Studio to a cloud Android emulator
You can run an app from Android Studio on a cloud Android emulator and debug it with breakpoints and Logcat. Limrun runs Android in the cloud. The lim CLI opens an Android Debug Bridge (ADB) tunnel on your machine, and Android Studio lists the remote emulator alongside any phones and local emulators you already have.
Start a cloud emulator and open the ADB tunnel
Install Android SDK Platform-Tools through Android Studio's SDK Manager and make sure adb is on your terminal's PATH. Android SDK Platform-Tools
Install the CLI, sign in, and start an Android 15 emulator:
npm install --global lim
lim login
lim android create --os-version 15 --rm --no-open
The terminal prints the ADB address, such as 127.0.0.1:49923. Leave the command running while you debug. With --rm, pressing Ctrl+C closes the tunnel and deletes the emulator.
If a teammate or an agent already created the emulator, copy the instance ID from the running device's console URL. It's the part after /stream/ that starts with android_. Replace ANDROID_INSTANCE_ID with that ID:
lim android connect --id ANDROID_INSTANCE_ID --no-detach
This keeps the tunnel in the foreground. When you stop the command, the existing emulator keeps running.
Run and debug from Android Studio
In a second terminal, run adb devices -l. Look for the address printed by lim and check that its state is device.
- In Android Studio, open your project and select the cloud emulator in the target device menu. Match its ADB address if you have several devices open.
- Select Run to build and install your app, or set a breakpoint and select Debug to launch the debug build with the debugger attached.
- From the View menu, open Tool Windows, then select Logcat. Select the same device and use
package:mineto see logs from packages in your open project.
To debug a preview that's already running, open the source for that build. From the Run menu, select Attach debugger to Android process, then select the app's debuggable process on the cloud emulator. The app keeps running while the debugger attaches. Attach the debugger to a running app
Android Studio still builds with your project's Android SDK and Gradle setup. If you already have an APK, you can install it from your terminal with just ADB:
# Replace the address with the one printed by lim.
ADB_SERIAL=127.0.0.1:49923
adb -s "$ADB_SERIAL" install -r ./app-debug.apk
adb -s "$ADB_SERIAL" logcat -b crash -d > crashes.txt
Use the same serial when you collect logs from a failed test. If you run Appium against the device, pass that address as appium:udid. Run an Android test with Appium
If the emulator does not show up
- If
adb devices -lshows no loopback address, check that the tunnel command is still running. Ifadblives outside yourPATH, pass--adb-pathwith the full path to the binary. - If the device shows as
offline, reconnect to its instance ID and use the newly printed address. The local port can change when you reopen the tunnel. - If ADB lists the device but Android Studio doesn't, check that Android Studio and your terminal use the same SDK's Platform-Tools. Then check the app's minimum SDK against the emulator's Android version.
- If your app normally talks to a backend running on your laptop, set up a destination tunnel. The ADB tunnel carries debugger traffic to Android. A destination tunnel lets the app reach your backend. Connect an emulator to local services
For the CLI, MCP, and CI options, see the cloud Android emulator setup guide.