Is there any solution of very slow Xamarin.Forms start on Android phone?

JosecanallaJosecanalla ARMember ✭✭

Hello, I developed a Xamarin.Forms app and I test it in a physical phone, a Motorola with Android 7, octacore and 4GB RAM. The main screen of my app opens in 4s and there only have three buttons, and a few labels. I don't do processing when the app is started, only I read value of App properties. After Google search, I read that there is a known problem of Xamarin.Forms. Is there any solution?

Thanks!

Answers

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @Josecanalla,

    The latest 2.3.4 version of Xamarin.Forms does include updates for Android startup time performance improvements. It's also still on the roadmap for more improvements. Make sure to try the latest release as that has improvements over any older information you find online.

    Latest roadmap items here: https://forums.xamarin.com/discussion/85747/xamarin-forms-feature-roadmap#latest

  • JosecanallaJosecanalla ARMember ✭✭

    @JohnMiller, thanks for your reply.

    How can I update the Xamarin version of my project? I am using VS 2017.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @Josecanalla,

    Right-click on your projects and select the Manage NuGet Packages. Use the NuGet Package Manager to update the Xamarin.Forms versions for your solution.

  • JosecanallaJosecanalla ARMember ✭✭

    @JohnMiller, I updated Xamarin.Forms (previously I have version 2.3.3). But the time to open app still is 4s :(

  • N_BauaN_Baua INMember ✭✭✭✭✭

    Hi @JohnMiller,

    (Apologies for hi-jacking this thread and tagging you, However, my direct questions don't end-up well many times :blush: )

    I have a project which took around 6-7 seconds to load on Android, while it had no splash screen and it used to show a white flicker screen, so I added a splash screen to the app. There should be no change in start-up time due to that, however sometimes it just goes 8-10 seconds at random.

    Could other possible reason be:

    • delay due to use of Settings plug-in, I am reading few strings on start-up and redirect the user based on the decision made thereof.
    • varying internet speed, as my user needs to be online and I check for network on start-up.
    • also supplying few false-flags for few classes to have linker in action and get the optimized APK (which still is around good 18Mb, better then 32Mb earlier.)
    • any other reasons, you can think of.

    Please suggest, I would like to show the App loaded and functional within 5 seconds, how can I further optimize!

    Regards,
    N Baua

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @N_Baua,

    Try removing those items that you mentioned and see if the startup time decreases. That would be the best way. Another option is to profile the application and see if you can identify areas that are taking up time.

    More recent versions of Xamarin.Forms have also been improved for Android startup times, so if you are using an old version that could be part of the issue too. If you run into anything else, please create a new forum post with the details. Thanks!

  • N_BauaN_Baua INMember ✭✭✭✭✭

    Hi @JohnMiller,

    Thanks for your prompt reply.

    Try removing those items that you mentioned and see if the startup time decreases. That would be the best way. Another option is to profile the application and see if you can identify areas that are taking up time.

    If you mean to say, splash screen, nothing changed major (may be few milli seconds here and there),
    If you are suggesting the false-flags used to instantiate few classes, I guess they should also not be impacting on start-up time, however essential they are as saving my APK from getting larger in size.
    Settings plug-in I have 8 string settings - of which 3 encrypted values (may be I'll check, if decryption is taking a bite).

    More recent versions of Xamarin.Forms have also been improved for Android startup times, so if you are using an old version that could be part of the issue too.

    Nope I've latest version of Xamarin.Forms (2.3.4.247) installed with PRISM (6.3.0) + Xam.Plugins.Settings(2.5.8)

    I'll still check further and create a post if needed (will also tag you, please don't mind).

    Regards,
    N Baua

  • MilosDumicMilosDumic RSUniversity ✭✭

    @N_Baua
    Hi, i'm using the same, Prism + Xamarin. Did you manage to improve startup time? Because i'm having the same problem. Just with later xamarin version, 2.5.0.

  • N_BauaN_Baua INMember ✭✭✭✭✭

    @MilosDumic said:
    @N_Baua
    Hi, i'm using the same, Prism + Xamarin. Did you manage to improve startup time? Because i'm having the same problem. Just with later xamarin version, 2.5.0.

    Hi,

    I just configured proguard for my project (android), it improved the APK file size and loading time a bit, however I guess this further depends how much your start-up activities you can strip off. I was making few API calls for getting user details etc, which I moved post splash screen which also helped me saving some MS in loading time.

    For proguard I referred this docs.

Sign In or Register to comment.