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

**URL:** <https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934>\
**Category:** ionic-v3\
**Created:** [August 1, 2018, 4:52am UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934 "2018-08-01T04:52:12Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmbsaturno](https://avatars.discourse-cdn.com/v4/letter/v/b9e5f3/32.png) [@vmbsaturno](https://forum.ionicframework.com/u/vmbsaturno)\
**Post date:** [August 1, 2018, 4:52am UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/1 "2018-08-01T04:52:12Z")

</div>

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`

 ![752c1f3f-8459-4ba8-baa9-9a190fa936dd](https://global.discourse-cdn.com/ionicframework/original/3X/6/8/68e4f43dea63566157582aa26aab62afc0a1fa1f.jpg)

with `app-release-unsigned.apk` not installed

API level installed

 ![apk-manager%20instalados](https://global.discourse-cdn.com/ionicframework/original/3X/9/0/90f551e96809988198af0568d1d0bcf1a886d43c.PNG)

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

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 1, 2018, 7:43am UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/2 "2018-08-01T07:43:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vmbsaturno](https://avatars.discourse-cdn.com/v4/letter/v/b9e5f3/32.png) [@vmbsaturno](https://forum.ionicframework.com/u/vmbsaturno)\
**Post date:** [August 1, 2018, 4:06pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/3 "2018-08-01T16:06:38Z")

</div>

Hello  
`ionic info`  
 ![ionic%20info%20falla](https://global.discourse-cdn.com/ionicframework/original/3X/8/0/80fcc81ea8634056a57e1518371f55b0e728c71e.PNG)

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.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 1, 2018, 4:59pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/4 "2018-08-01T16:59:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vmbsaturno](https://avatars.discourse-cdn.com/v4/letter/v/b9e5f3/32.png) [@vmbsaturno](https://forum.ionicframework.com/u/vmbsaturno)\
**Post date:** [August 1, 2018, 5:52pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/5 "2018-08-01T17:52:30Z")

</div>

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 model`Rocket 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.

 ![c5196833-4c79-4e6d-bf14-49120cf55bf4](https://global.discourse-cdn.com/ionicframework/original/3X/7/7/77430b5c1713fd0c2dafafa21ed72eaa8b095c6d.jpg) ![0666da50-2f32-44fd-9d1b-10d20f053ce4](https://global.discourse-cdn.com/ionicframework/original/3X/0/b/0b9eb1b3e659d5f0b0d17c05fcd814cac46395d0.jpg)

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 1, 2018, 7:17pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/6 "2018-08-01T19:17:26Z")

</div>

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](https://cordova.apache.org/docs/en/8.x/guide/platforms/android/index.html#requirements-and-support)

---

<div class="post-metadata">

**Author:** ![vmbsaturno](https://avatars.discourse-cdn.com/v4/letter/v/b9e5f3/32.png) [@vmbsaturno](https://forum.ionicframework.com/u/vmbsaturno)\
**Post date:** [August 1, 2018, 8:02pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/7 "2018-08-01T20:02:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 2, 2018, 9:33am UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/8 "2018-08-02T09:33:38Z")

</div>

I honestly don’t know. But:

> [@Sujan12](#):
>
> Cordova-Android version 7.0.0

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: [How to update Cordova CLI, Platforms and Plugins · ionic.zone](https://ionic.zone/cordova/update)

---

<div class="post-metadata">

**Author:** ![lucasbasquerotto](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/lucasbasquerotto/32/101719_2.png) [@lucasbasquerotto](https://forum.ionicframework.com/u/lucasbasquerotto)\
**Post date:** [August 2, 2018, 12:19pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/9 "2018-08-02T12:19:41Z")

</div>

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

```auto
ionic start myApp tabs --type=angular
cd myApp
npm i
ionic cordova run android

```

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 2, 2018, 4:32pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/10 "2018-08-02T16:32:51Z")

</div>

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

> [@Simple Ionic 3 App Not Working on Android Device](https://forum.ionicframework.com/t/simple-ionic-3-app-not-working-on-android-device/137047/4):
>
> Hello dumdem Which android version has your device? I’m having the same problem (and message) while testing on an Android v.4.4.3 smartphone, a blank app I’ve just created with ionic start MyApp blank I think it’s because the app uses the cordova-plugin-ionic-webview, and that plugin requires Android \>= 5; as they say on their github: [https://github.com/ionic-team/cordova-plugin-ionic-webview#requirements](https://github.com/ionic-team/cordova-plugin-ionic-webview#requirements) I’m still trying to find a workaround.

---

<div class="post-metadata">

**Author:** ![vmbsaturno](https://avatars.discourse-cdn.com/v4/letter/v/b9e5f3/32.png) [@vmbsaturno](https://forum.ionicframework.com/u/vmbsaturno)\
**Post date:** [August 5, 2018, 2:31am UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/11 "2018-08-05T02:31:22Z")

</div>

@Sujan12 Thanks

I used the @carlosjfuentesp solution:

```auto
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`?

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [August 5, 2018, 8:52pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/12 "2018-08-05T20:52:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:26pm UTC](https://forum.ionicframework.com/t/ionic-cordova-android-studio-compile-a-damaged-app-with-android/136934/13 "2021-07-19T21:26:23Z")

</div>

Closed on July 19, 2021, 9:26pm UTC


