Skip to content Skip to sidebar Skip to footer

Enabling Log In Pjsip For Android Forces Close The App

I'm building a SIP Softphone using PJSIP for android based on SWIG example. I enable log as described in the sample: LogConfig log_cfg = epConfig.getLogConfig(); SipLogWriter logW

Solution 1:

I had the same issue. I don't know is it actual now, but I solved, as adviced in Official Doc. Where notice it is Garbage Collection problems:

classMyApp {
    private MyLogWriter logWriter;

    publicvoidinit()
    {
        /* Maintain reference to log writer to avoid premature cleanup by GC */
        logWriter = new MyLogWriter();
        epConfig.getLogConfig.setWriter(logWriter);
    }
}

Solution 2:

As GensaGames said, you need to maintain a reference otherwise it's going to crash when the GC will decide to cleanup objects. If you use a dependency injector (eg: dagger 2), you can add you custom logwriter class to your graph dependency and set the scope to Singleton or your Application scope.

Post a Comment for "Enabling Log In Pjsip For Android Forces Close The App"