hackp0int
hackp0int

Reputation: 4161

Ionic with capacitor and Android not running emulator in IntelliJ

I ran npx doctor and npx cap sync

💊   Capacitor Doctor  💊 

 Latest Dependencies:

  @capacitor/cli: 2.2.1
  @capacitor/core: 2.2.1
  @capacitor/android: 2.2.1
  @capacitor/electron: 2.2.1
  @capacitor/ios: 2.2.1

Installed Dependencies:

  @capacitor/cli 2.2.1
  @capacitor/core 2.2.1
  @capacitor/android 2.2.1
  @capacitor/ios 2.2.1
  @capacitor/electron not installed

[success] Android looking great! 👌
  Found 0 Capacitor plugins for ios:
[success] iOS looking great! 👌
~/projects/private/growbox:🚀 ()$ npx cap open android
[info] Opening Android project at /Users//projects/private/growbox/android
~/projects/private/growbox:🚀 ()$ npx cap sync  
✔ Copying web assets from mobile to android/app/src/main/assets/public in 5.45s
✔ Copying native bridge in 10.89ms
✔ Copying capacitor.config.json in 8.76ms
✔ copy in 5.50s
✔ Updating Android plugins in 15.83ms
  Found 0 Capacitor plugins for android:
✔ update android in 86.12ms
✔ Copying web assets from mobile to ios/App/public in 5.37s
✔ Copying native bridge in 3.78ms
✔ Copying capacitor.config.json in 4.42ms
✔ copy in 5.41s
✔ Updating iOS plugins in 15.84ms
  Found 0 Capacitor plugins for ios:
✔ Updating iOS native dependencies with "pod install" (may take several minutes) in 26.92s
✔ update ios in 26.98s
✔ copy in 1.30ms
✔ update web in 5.00μp
Sync finished in 38.021s

This is what I got and after that I ran: npx cap open android

Got: [info] Opening Android project at /Users//projects/private/growbox/android

And nothing happening. I have emulator running and everything properly installed and I'm using IntelliJ Ultimate latest

Upvotes: 4

Views: 4762

Answers (2)

Software Prophets
Software Prophets

Reputation: 2976

If you are running on Linux (Windows below), to open in IntelliJ Ultimate, simply edit the capacitor.config.json file and add the linuxAndroidStudioPath as another top-level property of the JSON file:

{
     "appId": "com.foo.app",
     "appName": "FooBar",
     "bundledWebRuntime": false,
 ...
     "linuxAndroidStudioPath": "/opt/idea-IU-201.7846.76/bin/idea.sh"
}

Run

npx cap open android

If IntelliJ is already open, then it gives the familiar dialog for opening in the current window or in a new window.

If you're running on Windows, it looks like the option is windowsAndroidStudioPath

The Windows parameter was taken from the capacitor configuration page.

Upvotes: 1

jcesarmobile
jcesarmobile

Reputation: 53341

Capacitor open command try to open Android Studio, if you use IntelliJ, you'll have to open it manually.

There is a feature request for opening different IDEs https://github.com/ionic-team/capacitor/issues/3242

Upvotes: 4

Related Questions