Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Deploying from WSL2 to on an emulator running on Windows #5308

Closed
thoro23 opened this issue Dec 10, 2021 · 2 comments
Closed

bug: Deploying from WSL2 to on an emulator running on Windows #5308

thoro23 opened this issue Dec 10, 2021 · 2 comments

Comments

@thoro23
Copy link

thoro23 commented Dec 10, 2021

Bug Report

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 3.3.3
  @capacitor/core: 3.3.3
  @capacitor/android: 3.3.3
  @capacitor/ios: 3.3.3

Installed Dependencies:

  @capacitor/ios: 3.1.2
  @capacitor/android: 3.1.2
  @capacitor/core: 3.1.2
  @capacitor/cli: 3.1.2

Platform(s)

android

Current Behavior

I have a setup where the android emulator is running on my windows machine but my project is in WSL2 on the same machine. I have setup adb so connected devices and emulators are shown when I run adb devices inside WLS2.
Unfortunately when I run npx cap run android I get the following output:

✔ Copying web assets from www to android/app/src/main/assets/public in 185.90ms
✔ Creating capacitor.config.json in android/app/src/main/assets in 2.08ms
⠼ copy android [info] Found 1 Cordova plugin for android:
       [email protected]
✔ copy android in 239.00ms
✔ Updating Android plugins in 18.65ms
[info] Found 9 Capacitor plugins for android:
       @capacitor-community/[email protected]
       @capacitor/[email protected]
       @capacitor/[email protected]
       @capacitor/[email protected]
       @capacitor/[email protected]
       @capacitor/[email protected]
       @capacitor/[email protected]
       @capacitor/[email protected]
       @capacitor/[email protected]
⠸ update android [info] Found 1 Cordova plugin for android:
       [email protected]
✔ update android in 181.47ms
✔ Running Gradle build in 6.13s
✖ Deploying app-debug.apk to Pixel_3_API_30 - failed!
[error] node:events:368
        throw er; // Unhandled 'error' event
        ^

        Error: connect ECONNREFUSED 127.0.0.1:5554
        at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)
        Emitted 'error' event on Socket instance at:
        at emitErrorNT (node:internal/streams/destroy:157:8)
        at emitErrorCloseNT (node:internal/streams/destroy:122:3)
        at processTicksAndRejections (node:internal/process/task_queues:83:21) {
        errno: -111,
        code: 'ECONNREFUSED',
        syscall: 'connect',
        address: '127.0.0.1',
        port: 5554
        }

Expected Behavior

I expected capacitor to connect to my emulator running on windows.

Other Technical Details

I've done some digging and found that native-run only looks for hardware devices using adb and if none found tries to open an emulator (see ionic-team/native-run#213). In my case it tries to start an emulator on my WLS2 which is not setup.

@jcesarmobile
Copy link
Member

The issue is on native-run, you already reported it there
ionic-team/native-run#213

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants