Capacitor 3.0 Live Reload Problem

Hello.

My referance tutorial is this official tutorial.

I’m on Ubuntu 20.04 up-to-date. Android Studio installed as a snap package and it’s running perfectly. adb server is on and detecting my phone. My phone’s development mode is enabled as well as USB installation. My app runs perfectly on both VM Android and my physical phone through Android studio.

But the problem I’m having that the ionic cap run android -l --external command returns an empty list.

And also ionic capacitor run android --list command returns [INFO] No native targets found..

I’ve tried with both Android Studio’s adb and Ubuntu’s official repo adb but ended up with no luck. I’ve also tried to run ionic cap run android -l --external with CAPACITOR_ANDROID_STUDIO_PATH=/snap/android-studio/current/android-studio/bin/studio.sh environment as I did at ionic cap open android command but that didn’t help either.

I’ve also tried several combination while app running on my phone through Studio. But none of those combinations worked.

What am I missing?

I’ve solved the problem with reading the source code. Found out ioinic cap run commands calls the native-run command which is documented here. It turns out my problem was ERR_SDK_NOT_FOUND: No valid Android SDK root found. by the native-run because of my SDKs are not in default location.

When I passed ANDROID_HOME and CAPACITOR_ANDROID_STUDIO_PATH environments with the right values and the problem seems solved and everything works flawless.

PS: You can try --verbose flag to find out which path the native-run looking for and check against your paths.

2 Likes

Worked for me, too. Thank you. Lists my real devices now. AVD devices are not shown unfortunately.