Giter VIP home page Giter VIP logo

Comments (7)

mSobhy90 avatar mSobhy90 commented on May 31, 2024

Hey @Karambar, thanks for reporting this.
We're currently looking into it, can you please provide me with more details (if any). Like, is it something consistent, is the maps activity the last activity in your stack or are you using the home button and removing it from recents, etc...

from instabug-android.

Karambar avatar Karambar commented on May 31, 2024

Hi @mSobhy90 , thanks for your answer.

I did some tests and I have found which use of the SDK was generating this bug. I initialise the Instabug SDK from my custom Application class and I immediately disable it using the method Instabug.disable().
Indeed, I want to make this feature only available for some clients so I disable it by default and only enable it according to a list of beta testers. However, call the method Instabug.disable() just after the SDK initialisation cause a crash when I leave the app. If I don't disable the SDK, everything is fine and the app is not crashing anymore.

Do you have a tips for me to only enable Instabug for some clients ? I could build the SDK after the login process but I find this usage dangerous.

Otherwise, to answer your questions, this crash is consistent and appears on every devices I have. Moreover, I'm not using the home button, I press the back button which makes me leave the app because the maps activity is the last activity in my stack.

from instabug-android.

mSobhy90 avatar mSobhy90 commented on May 31, 2024

Hi @Karambar, thanks for the detailed report.

As for the use-case you mentioned, I've checked it out and was able to re-produce the bug as follows:

  • Disable Instabug after building it
  • Enable it on an activity button click
  • Close the application
  • Kaboom

And I'll work on a fix right away.

As for enabling Instabug to certain users, we had that case in mind when designing the builder.
You can build Instabug in the Application class as normal with 1 difference, the build() function has an overload which takes state build(Feature.State instabugInitialState). So in that scenario you'll have something following this pattern.

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        new Instabug.Builder(this, "<TOKEN>")
                .build(Feature.State.DISABLED);
    }
}

And then when user clicks some button in the settings screen (or wherever):

        if (Instabug.isEnabled()) {
            Instabug.disable();
        } else {
            Instabug.enable();
        }

That should achieve your scenario. Can you please confirm?

from instabug-android.

Karambar avatar Karambar commented on May 31, 2024

Thanks @mSobhy90 for your detailed answer !

We integrated your modifications and the behaviours is much more better, however we noticed a new issue in a very specific use-case.
You can reproduce this bug following these steps:

  • Build Instabug with build(Feature.State.DISABLED)
  • Enable it on activity button click (log in button in our app)
  • Disable it programmatically when the user click on a button (logout button for us)
  • Kill the app
  • Relaunch the app (It will build Instabug as in the first step)
  • Enable Instabug on activity button click (same as the second step)
  • Close the app
  • Kaboom !

And it generates the following stack trace :

INSTABUG - Instabug: Instabug Caught an Unhandled Exception: java.lang.RuntimeException java.lang.RuntimeException: Unable to stop activity {fr.chauffeurprive.preprod/fr.chauffeurprive.presentation.order.view.OrderActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.instabug.library.internal.e.a.d.b()' on a null object reference at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3500) at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3550) at android.app.ActivityThread.-wrap20(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.instabug.library.internal.e.a.d.b()' on a null object reference at com.instabug.library.internal.e.a.o.c(ReadQueueCacheManager.java:60) at com.instabug.library.k.b(SessionManager.java:59) at com.instabug.library.ab.d(InstabugDelegate.java:283) at com.instabug.library.Instabug.notifyDelegateActivityStopped(Instabug.java:142) at com.instabug.library.v.onActivityStopped(InstabugActivityLifecycleListener.java:41) at android.app.Application.dispatchActivityStopped(Application.java:232) at android.app.Activity.onStop(Activity.java:1620) at android.support.v4.app.FragmentActivity.onStop(FragmentActivity.java:562) at fr.chauffeurprive.presentation.order.view.OrderActivity.onStop(OrderActivity.java:415) at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1278) at android.app.Activity.performStop(Activity.java:6395) at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3497) at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3550) at android.app.ActivityThread.-wrap20(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

The crash seems to be the same, please let me know if you need more details or if you want me to do a new issue for this bug.

from instabug-android.

mSobhy90 avatar mSobhy90 commented on May 31, 2024

Hi @Karambar, sorry for my late response, and thanks again for your detailed reports it's deeply appreciated.
I've been able to reproduce the issue, and I've worked out a fix for both cases. It'll be rolling out by end of today.
Thanks a lot @Karambar for helping us make Instabug better. 🍻

from instabug-android.

mSobhy90 avatar mSobhy90 commented on May 31, 2024

Closing this since v2.2 was released containing this fix

from instabug-android.

Karambar avatar Karambar commented on May 31, 2024

Thank you very much @mSobhy90 for your reactivity !
We integrated your new release and everything seems to be OK . 🚀

from instabug-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.