ionic-cli
ionic-cli copied to clipboard
ionic cordova run android --livereload does not work with a default project
I have start a project with this:
nvm install 10.16.3
nvm use 10.16.3
npm install -g ionic
npm install -g cordova
ionic start myApp tabs --cordova
cd myApp
ionic cordova run android --livereload
Without --livereload
the app works:
But with --livereload
I have just a white screen and this:
BUILD SUCCESSFUL in 2s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
C:\test\myApp\platforms\android\app\build\outputs\apk\debug\app-debug.apk
> native-run.cmd android --app platforms\android\app\build\outputs\apk\debug\app-debug.apk
[native-run] No hardware devices found, attempting emulator...
[native-run] Selected emulator emulator-5554
[native-run] Installing platforms\android\app\build\outputs\apk\debug\app-debug.apk...
[native-run] Starting application activity io.ionic.starter/io.ionic.starter.MainActivity...
[native-run] Run Successful
I'm using VScode with Git Bash on Windows 10.
It's probably a problem with the SDK, it works with ionic cordova run android --device --livereload
.
@Zefling If you see a white screen, the best thing to do is use Chrome DevTools to remotely see the error: https://ionicframework.com/docs/building/android#debugging-android-apps
I also encountered this problem. devtool log nothing and do not load anything from www
directory.
this is my development env
Angular 8.0 auto load bundled script by module
type if target
is set to 2015
in tsconfig.json
, so old browser can not load these script.
same issue here.
Same here ! ionic cordova run android --device --livereload --> cause: ERR_EMPTY_RESPONSE ionic cordova run android --device --> works fine
Ionic:
Ionic CLI : 7.1.1 (C:\Users\Pablo\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 6.2.8
@angular-devkit/build-angular : 14.2.3
@angular-devkit/schematics : 14.2.3
@angular/cli : 14.2.3
@ionic/angular-toolkit : 6.1.0
Cordova:
Cordova CLI : 11.0.0
Cordova Platforms : android 11.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 9 other plugins)
Utility:
cordova-res (update available: 0.15.4) : 0.15.2
native-run (update available: 1.7.2) : 0.2.8
System:
Android SDK Tools : 26.1.1 (C:\Users\Pablo\AppData\Local\Android\Sdk\)
NodeJS : v18.15.0 (C:\Program Files\nodejs\node.exe)
npm : 9.3.1
OS : Windows 10
Is there any solution? I am stuck same issue
Same here ! ionic cordova run android --device --livereload --> cause: ERR_EMPTY_RESPONSE ionic cordova run android --device --> works fine
Ionic: Ionic CLI : 7.1.1 (C:\Users\Pablo\AppData\Roaming\npm\node_modules\@ionic\cli) Ionic Framework : @ionic/angular 6.2.8 @angular-devkit/build-angular : 14.2.3 @angular-devkit/schematics : 14.2.3 @angular/cli : 14.2.3 @ionic/angular-toolkit : 6.1.0 Cordova: Cordova CLI : 11.0.0 Cordova Platforms : android 11.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 9 other plugins) Utility: cordova-res (update available: 0.15.4) : 0.15.2 native-run (update available: 1.7.2) : 0.2.8 System: Android SDK Tools : 26.1.1 (C:\Users\Pablo\AppData\Local\Android\Sdk\) NodeJS : v18.15.0 (C:\Program Files\nodejs\node.exe) npm : 9.3.1 OS : Windows 10
Is there any solution? I am stuck same issue
Same here ! ionic cordova run android --device --livereload --> cause: ERR_EMPTY_RESPONSE ionic cordova run android --device --> works fine
Ionic: Ionic CLI : 7.1.1 (C:\Users\Pablo\AppData\Roaming\npm\node_modules\@ionic\cli) Ionic Framework : @ionic/angular 6.2.8 @angular-devkit/build-angular : 14.2.3 @angular-devkit/schematics : 14.2.3 @angular/cli : 14.2.3 @ionic/angular-toolkit : 6.1.0 Cordova: Cordova CLI : 11.0.0 Cordova Platforms : android 11.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 9 other plugins) Utility: cordova-res (update available: 0.15.4) : 0.15.2 native-run (update available: 1.7.2) : 0.2.8 System: Android SDK Tools : 26.1.1 (C:\Users\Pablo\AppData\Local\Android\Sdk\) NodeJS : v18.15.0 (C:\Program Files\nodejs\node.exe) npm : 9.3.1 OS : Windows 10
Hello!
Yesterday I found a solution to this problem. (for android obviously)
in folder
resources/android/xml/network_security_config.xml
you have to add the IP address of your pc to allow the device to recognize that domain. this is a example.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">192.168.0.5</domain>
</domain-config>
</network-security-config>
then confirm that your config.xml you have this configuration.
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" android:usesCleartextTraffic="true" />
</edit-config>
this is important because set netWorkSecurityConfig and ClearTraffic
and then check proxy config in ionic.config.json and set proxies
"proxies":[
{
"path": "/192.168.0.5",
"proxyUrl":"http://192.168.0.5:PORT"
}
]
and set the port correctly
sorry, I forgot to clarify that you must run this command in order to run livereload
ionic cordova run android --no-native-run -l --external
I hope you find it helpful