Search code examples
androidangularnativescriptnativescript-angularnativescript-plugin

Nativescript 8 Screen freeze after splash screen is loaded in release build


Guys I'm working on one of my own projects, and I'm using

nativescript 8.2.1 along with angular 13.2.0

I had some weird issue that is when we run the project using the following command

"ns run android"

application getting compiled and running on emulator fine.

enter image description here

but if I build to production and run it on an emulator I can only see a blank screen or white screen, here is the command used for that

"ns run android --clean --release --key-store-path "PATH/my-release-key.keystore" --key-store-password myPass --key-store-alias myAlias --key-store-alias-password myPass"

this is screenshot enter image description here

This is what my root route looks like, redirection to home route is not working. but I tested if I add a button to app.component.html then I can see that button on the emulator screen. but routing is not working enter image description here

This issue is caused when we only build with --release command otherwise debug mode it's working fine.

need your help on this


Solution

  • After spending multiple days of debugging, I finally, figure out the reason why the production build screen is getting frozen.

    This is happening due to Firebase

    I configure the firebase to my app referring through Nativescript version 8 documentation, here is the configuration that I have did https://docs.nativescript.org/plugins/firebase-firestore.html

    npm install @nativescript/firebase-firestore

    //importing firebase modules
    import { firebase } from "@nativescript/firebase-core";
    import "@nativescript/firebase-firestore";
    
    //Initialize firebase as per nativescript documentation
    await firebase().initializeApp();
    

    in debug mode, this is working fine without any issue, but the production release builds it's not working.

    For resolve this issue. I used a different firebase package. here is the documentation link https://github.com/EddyVerbruggen/nativescript-plugin-firebase

    if you are NativeScript 7+:

    tns plugin add @nativescript/firebase

    for NativeScript 6:

    tns plugin add nativescript-plugin-firebase

    Thanks..