Debug on Android Device not works: ERR_EMPTY_RESPONSE / ERR_CONNECTION_REFUSED

I have debug problem using my android device. I have read many posts and done many tests but I can’t solve the problem

In the past, with old version of ionic and cordova, I used debugging and loadreload mode. I am going crazy-

PS C:\projects\mgdlab\ionic\gemar-app> ionic info

Ionic:

   Ionic CLI                     : 7.1.5 (C:\tools\nvm\v18.16.0\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.7.4
   @angular-devkit/build-angular : 13.3.11
   @angular-devkit/schematics    : 12.2.18
   @angular/cli                  : 13.3.11
   @ionic/angular-toolkit        : 4.0.0

Cordova:

   Cordova CLI       : 11.1.0
   Cordova Platforms : android 11.0.0, browser 6.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 15 other plugins)

Utility:

   cordova-res : not installed globally
   native-run  : 2.0.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\myuser\AppData\Local\Android\Sdk)
   NodeJS            : v18.16.0 (C:\Program Files\nodejs\node.exe)        
   npm               : 9.5.1
   OS                : Windows 10

If I execute this command:

ionic cordova run android --device --debug

the app is loaded on the device. it works, but debugging (chrome://inspect) and live reload do not work

If I execute the same command with -l or --livereload option

ionic cordova run android -l --device --debug

the app is loaded on the device but it shows this message

ERR_EMPTY_RESPONSE / ERR_CONNECTION_REFUSED

Did you find any solution? I am stuck with same issue.

I solve by using --external parameter. For htpps external dev server, create a SSL with “ionic SSL generate” and use --ssl parmater in your command.

Could you please help me? I can’t solve my issue. I can’t use live debugging.