Slow application startup after a build in android studio

Hello, my application takes on average 16 sec to start, I built it under android studio, it produces an app-release.apk. I do not understand the reason.

build ionic app with this command - ionic cordova build android --prod --aot

Tank you,When I execute this command I have this error. That’s the other reason why I build by android studio.

Android Studio project detected

JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_162
Erreur : can not find or load the main class Xmx2048M

(node:17724) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users**********\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:17724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17724) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Here is the information of my system

cli packages: (C:\Users********\AppData\Roaming\npm\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.9
Cordova Platforms  : android 7.0.0 browser 5.0.3
Ionic Framework    : ionic-angular 3.9.2


Android SDK Tools : 26.1.1
Node              : v8.10.0
npm               : 5.6.0
OS                : Windows 10

Environment Variables:

ANDROID_HOME : C:\Users\******\AppData\Local\Android\Sdk


backend : pro

I do not know what to do!

1 Like

Have you tried to remove the platform and add the platform again ?

1 Like

I even created a new ionic project then add the android platform. The construction gives me the same error

1 Like

I think the problem comes from here.

Have you added any plugins ?

@LeFredy09 make a simple project and check if the project build or not.

No it’s still an empty project

That’s what I did. I created a simple project. the simple command ionic cordova build android does not work.

Then you have some issue with ionic installation or android SDK. reinstall ionic and check your android SDK.

Tks, it worked for me !