Slow application startup after a build in android studio


#1

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.


#2

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


#3

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

ANDROID_HOME=C:\Users******\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_162
studio
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

System:

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

Misc:

backend : pro

I do not know what to do!


#4

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


#5

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


#6

I think the problem comes from here.


#7

Have you added any plugins ?


#8

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


#9

No it’s still an empty project


#10

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


#11

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


#12

Tks, it worked for me !