Ionic – Manually build an App for Android, like AppFlow does on Ionic Package

When using Ionic Package to build app on the cloud, the executed command is not as trivial as

ionic cordova build android --prod --release

To mimic the behavior performed by Ionic Package, follow those steps:

    1. Add platform Android if needed
    2. ng build –configuration=production –prod –source-map
    3. Edit www/index.html and add this line in the HEAD section
      1. <script src="cordova.js"></script
    4. cordova build android
      1. Add those flags if building for production
        1. –release — –keystore=android.keystore –storePassword=***** –alias=key0_eventflow –password=*****

Why would you do that ? Well, we observed that the build is not exactly the same as on our local machines… so it might be useful.

With this kind of build, you can debug the app with Chrome adb inspect.

Ionic – No provider for t! …

$ ionic info

Ionic:

ionic (Ionic CLI) : 4.10.2 (/home/tanguy/.nvm/versions/node/v8.11.3/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.3.0

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, browser 5.0.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 19 other plugins)

System:

Android SDK Tools : 26.1.1 (/home/tanguy/Softwares/android-sdk/Sdk)
NodeJS : v8.11.3 (/home/tanguy/.nvm/versions/node/v8.11.3/bin/node)
npm : 6.5.0
OS : Linux 4.15

 

I was building for production, on Android a project using Push native plugin.

I encountered an error “No provider for t! white screen”

The problem was caused because I forgot to add Push to the providers of my app.module.ts and the documentation say nothing about it on the plugin page.

However, it was stated here: https://ionicframework.com/docs/native/#angular

Import the plugin in a @NgModule and add it to the list of Providers. For Angular, the import path should end with /ngx. Angular’s change detection is automatically handled.