ionic capacitor isn't generating run config for the android emulator

Viewed 805

I'm follwing the guide in this section: https://ionicframework.com/docs/developing/android#running-with-capacitor

However, when I get to:

  1. In Android Studio, click the Run button and then select the target simulator or device.

Which I'm getting to by issuing npx cap open android, I can't click 'run' because there's no run configuration. If I try to Add Configuration I can't select my app directory (or any directory) as the module - it just says <no module> in the dropdown.

Is there a step I'm missing or something that causes this? Thanks!

2 Answers

For anyone this may benefit, in my case I had installed the Android SDK platform but not the requisite SDK tools. There is a second tab in the Android Studio > Settings > Appearance & Behavior > System Settings > Android SDK menu called SDK Tools. You need to make sure you also install the correct tools from there.

To get the run configuration I believe you at least need the Android SDK Build-Tools.

Managed to fix it, you should ignore the sections on creating a new virtual device if you have one already. In essence the issue was that my AVD was v28 and my SDK was v30 so it wasn't compatible hence no config.

Related