Search code examples
ionic-frameworkapkionic4android-install-apk

Error when I try to install app-debug.apk generated by ionic4, on an mobile


I have already done all possible tests, deleted the platforms/android directory and re-generated, deleted the node_modules and re-installed. But whenever I generate the apk to debug, the error continues.

The ionic cordova build android --prod command runs without any problem and generates the apk, as you can see below

BUILD SUCCESSFUL in 20m 9s
42 actionable tasks: 42 executed
Built the following apk(s):
        D:\life\Ionic Projects\myHealth\platforms\android\app\build\outputs\apk\debug\app-debug.apk

The problem is when I try to install the apk on real device, I get an error App not installed. See below:

Imgur

My ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (C:\Users\Sumburane\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 ([email protected])
   Cordova Platforms     : android 8.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 4 other plugins)

System:

   NodeJS : v8.9.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.9.0
   OS     : Windows 10


My real device android version

Imgur


Solution

  • As strange as it sounds the problem is in the version of Node.js and npm, what I did was to download the new version of Node.js and install it.
    Next I updated the npm running: npm install -g npm. Finally I deleted the node_modules directory and generated everything again:

    npm install
    ionic cordova build android
    

    So now my Node.js and npm versions are:

    NodeJS : v10.15.3
    npm    : 6.9.0