ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
12.18k stars 1.01k forks source link

bug: long startup time on android #6115

Closed farisfaisalthena closed 1 year ago

farisfaisalthena commented 1 year ago

Bug Report

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 4.5.0
  @capacitor/core: 4.5.0
  @capacitor/android: 4.5.0
  @capacitor/ios: 4.5.0

Installed Dependencies:

  @capacitor/cli: 4.5.0
  @capacitor/core: 4.5.0
  @capacitor/android: 4.5.0
  @capacitor/ios: 4.5.0

Platform(s)

Android

Current Behavior

After migrating from Cordova to Capacitor, we noticed there a long startup time compared to the old Cordova App. To compare, the old Cordova app takes around 5 seconds before content is displayed while the newly migrated Capacitor app takes around 13 seconds before content is shown. Please note that I am just comparing the startup time as for the team to reproduce the issue which is why I am not mentioning about the lag.

Expected Behavior

I believe Capacitor app should have similar if not better startup time compared to Cordova.

Code Reproduction

  1. Head over to release/v4 branch here for the issue
  2. Build for Android
  3. Run in Simulator

Other Technical Details

npm --version output: 8.15.0

node --version output: v16.17.0

pod --version output (iOS issues only): N/A

Additional Context

To compare the old Cordova app head over to the master branch here

jcesarmobile commented 1 year ago

I've tested in a few emulators and the app is taking ~3 seconds to show your login screen in all of them. I get similar launch time in master branch (I had to update to cordova-android 11 and remove some plugins that weren't building in that version, so the results might be different from yours). But in both cases it's faster than the 5 seconds you mention.

Also note that the difference between master branch and release/v4 isn't just changing cordova with capacitor, you have also updated ionic from 5 to 6, angular from 10 to 13, and a lot more changes that could have affected the app performance.

Can you provide more information about how are you testing/running? You mention "simulator", is that a regular Android AVD emulator? What's it's Android version and WebView version?

farisfaisalthena commented 1 year ago

Yeah its regular avd emulator. The long startup time I tested on a real device which is on Samsung Galaxy A12 (2020 Model) running on Android version 12. But its not showing the splashscreen for a long time instead a black/white screen will appear for awhile. I tried disabling splash screen but still same. Its also visible on ios but it does not take as long as android

juanmaldonadodev commented 1 year ago

@farisfaisalthena Have you reach any improvement? We face similar problem

sksk008 commented 1 year ago

i am also facing same issue.

jcesarmobile commented 1 year ago

closing as I can't reproduce the long startup time and the app update did much more than just changing from Cordova to Capacitor

the splash screen not appearing on Android 12 is an Android 12 bug, it won't show when launching the app from Android Studio and some other places. Should work when launched from the app icon, but it also depends on the device launcher, some launchers present problems too.

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.