Ionic App Mobile Error on Cellular

Hello friend , please anyone can help me , so i am developing an mobile application with ionic 3 , angular 6 and a back-end with spring-boot , after my first build release , the application work fine on computer and mobile device simulation after the installation to my cellular for testing when i click to the app for begin i get this error : Application Error , Couldn’t connect to the server .(http://localhost:8080/) .
Thanks!

What is your ionic info output?
What device are you testing on?

here is my output info :
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser -
Ctrl+C to cancel
[11:14:44] watch started …
[11:14:44] build dev started …
[11:14:44] clean started …
[11:14:44] clean finished in 43 ms
[11:14:44] copy started …
[11:14:45] deeplinks started …
[11:14:45] deeplinks finished in 93 ms
[11:14:45] transpile started …
[11:15:21] transpile finished in 35.44 s
[11:15:21] preprocess started …
[11:15:21] preprocess finished in less than 1 ms
[11:15:21] webpack started …
[11:15:21] copy finished in 36.95 s
[11:15:35] webpack finished in 14.11 s
[11:15:35] sass started …
Without from option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to undefined to prevent this warning.
[11:15:38] sass finished in 2.97 s
[11:15:38] postprocess started …
[11:15:38] postprocess finished in 31 ms
[11:15:38] lint started …
[11:15:38] build dev finished in 54.19 s
[11:15:38] watch ready in 54.65 s
[11:15:38] dev server running: http://localhost:8100/

[OK] Development server running!
Local: http://localhost:8100
External: http://192.168.1.150:8100
DevApp: ConceptApp@8100 on sowlinux

[11:15:45] lint finished in 7.51 s

I am testing on Sony Xperia c3 .
here is my ionic info :
cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.1.11
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 25.2.5
Node              : v10.4.1
npm               : 6.1.0 
OS                : Linux 3.13

Environment Variables:

ANDROID_HOME : /home/sow/AndroidSDK/android-sdk-linux

Misc:

backend : pro

What command are you running?
And how are you testing? With an app?

i execute the command ionic info and for testing after the build in my computer i recover the .apk file and instaling to my cellular .
Thanks!

Sorry, this doesn’t make too much sense. The output above looks like for ionic serve. But you are telling me you built an apk and installed it on the device?

yes and generally after building the apk it work fine .
the error appear in my phone : Application Error , Couldn’t connect to the server .(http://localhost:8080/)

How did you build that apk?
What device are you testing on? Android versoin? Device model?

How did you build that apk? = ionic cordova build android
What device are you testing on? = with my telephone after building
Android versoin? = android 7.0.0
Device model? = Sony Xperia c3
thanks
this an hybrid app and in my computer it work fine .

Are you sure that is not the version of Cordova-Android?

That device is 4 years old. Do you have a newer one?

No i believe it is not the version of cordova android , and my previous app is testing by the same device and it work fine .
May be it is a simple configuration , so i don’t now .3921914d8b29c8175bcc3ffe6ced77b218fae5f5_1_281x500

@swlab That problem seems weird to me. I already saw a problem like:

Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)

It already happened to me, and the solution was to increase the timeout, like in:

But in your case it tries to connect to http://localhost:8080/.

How is your package installed in your device? You said you run:

ionic cordova build android

That builds the package, but how do you deploy it to your device? Do you connect your Android device via USB and run:

cordova run android --nobuild

so that the app is deployed to your device? If not, try to do that.

If the error persists, try to start a new ionic project and deploy it to your device. Do you get the same error or it works?

ionic start myApp tabs
cd myApp
npm i
ionic cordova run android

i build the apk with ionic cordova build android and after i take the .apk file with the my usb cable and install it to the telephone .

me i not deploy direct to my device , i build the apk with ionic cordova build android and after i take the .apk file with the my usb cable and install it to the telephone .

my previous app work well with this methode and the same environment.

3921914d8b29c8175bcc3ffe6ced77b218fae5f5_1_281x500

1 Like

I guess dont use ionic cordova build/run android --livereload
instead use ionic cordova build/run android

ionic cordova build android

Is the ionic info of this other app identical?

yes , the same ionic info