Ionic, cordova, android studio Compile a damaged app with Android

#1

I installed the latest version of ionic, cordova and android studio with APK MANAGER with API 26.
Compiled the app: First:
ionic cordova platform add android
then:
ionic cordova build android --release
and
ionic cordova build android.
It generates the apk but when I put it in the phone it says:

‘aplication error could not connect to the server. (Http: // localhost: 8080)’

Attached photo of APK installed on Android with app-debug.apk

with app-release-unsigned.apk not installed

API level installed

I did the test compiling in Windows and Debian and the same thing happens doing an example app of ionic: ionic start app1 tabs or blank this gives me an app-release-unsigned.apk file of 3.6MB and an app-debug.apk of 4.3MB . Being generally 600KB

ionic 4.0.2
cordova 8.0.0
npm 5.6.0

#2

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

#3

Hello
ionic info

I am test in Android 4.4.2 with ionic serve

I try on android where I get the flaw and also simulate with ionic serve where it works without problems.

#4

What device are you testing on?
Can you try a newer one?

#5

Update ionic because it said it was outdated ioinic-cli this made the app-debug.apk of 4.3MB down to 1MB. Then I tried in android modelRocket version 4.4.2 and the fault persists, I tried with a model SM-G800H (SAMSUNG S5 mini) version 6.0.1 and installed it showing the blank app without problem shows what it should show. Then uninstall it and reinstall the same app and tell me that it can not be installed, restart the samsung and I still fail (And this should be another problem).

Previously I had compiled in the ROCKET 4.4.2 and had no problems. How can I make it recognize the previous versions of android?

Attached print-screen phone model.

#6

Your Cordova-Android version 7.0.0 should still support Android 4.4.2:
https://cordova.apache.org/docs/en/8.x/guide/platforms/android/index.html#requirements-and-support

#7

So what’s up? What is the problem? Thank you

#8

I honestly don’t know. But:

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: https://ionic.zone/cordova/update

#9

@vmbsaturno If you start a new ionic project and deploy it to your device do you get that error?

ionic start myApp tabs --type=angular
cd myApp
npm i
ionic cordova run android
#10

If your device is running Android <5, your issue might be similar to this here:

1 Like
#11

@Sujan12 Thanks

I used the @carlosjfuentesp solution:

cordova plugin rm cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview@1.2.1
ionic cordova platforms remove android
rm -rf plugins
ionic cordova build android

and it runs perfect in android 4.4.2.

@lucasbasquerotto also tried your proposal but it did not solve the problem. Thanks.

Now I do not understand why the apk file of a project ionic start app blank weighs 4.2Mb with ionic cordova build android and 1.1Mb with ionic cordova build android --prod when previously compiling this apk weighed 600Kb?

#12

Best open a new topic and include all relevant information for that problem.