简体   繁体   中英

My androids app have Activitynotfoundexception based crashes on some devices. How can i regenerate it?

I have an Android app released on Google Play. It works fine but some users complains about app crashes when it's opened. On Play console there is an %2,5 crash rate and all of them are activitynotfoundexception . But me or my several android user friends didn't experience any crash on real devices. I also tested it on several emulators from api 21 to 30 (because on crash report Android version varies) but still had no problem.

I have proguard enabled which can cause this exception but i think if proguard was the cause all users would experience same problem, not %2,5 of them.

My app starts with a splash screen activity, which only shows up an image and after 1 second delay calls the main activity, which is technically a login page. Users are directed to webview activity if they click to "login via web" button there. On %80 percent of crash reports, it says it couldn't find the webview activity, and rest of them are abut not finding main (login) activity. All activities are declared on manifest file.

An example crash report:

android.content.ActivityNotFoundException: 
  at android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:2069)
  at android.app.Instrumentation.execStartActivity (Instrumentation.java:1717)
  at android.app.Activity.startActivityForResult (Activity.java:5250)
  at android.support.v4.app.f.startActivityForResult (BaseFragmentActivityApi16.java:3)
  at android.app.Activity.startActivityForResult (Activity.java:5208)
  at android.support.v4.app.i.startActivityForResult (FragmentActivity.java:4)
  at android.app.Activity.startActivity (Activity.java:5579)
  at android.app.Activity.startActivity (Activity.java:5547)

  **at com.myPackageName.myAppName.MainActivity.a (MainActivity.java:33)
  at com.myPackageName.myAppName.MainActivity$c.onResponse (MainActivity.java:9)**

  at okhttp3.RealCall$AsyncCall.execute (RealCall.java:5)
  at okhttp3.internal.NamedRunnable.run (NamedRunnable.java:3)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:919)

Any suggestions about where should i dig? How can i regenerate this crash? Thanks.

The problem might be that you leak a reference to your activity, and later the activity is killed and re-created for any number of reasons. Then the old reference to your activity is used and it causes a crash. This fits your situation, as your app may work ok in some memory usage conditions and crash in other conditions unpredictably. In your stack trace I see that you have an inner class MainActivity$c which (if it is not static) has an implicit reference to your activity class. So if you leak a reference to MainActivity$c, you also leak a reference to MainActivity. Check your code for leaks of this kind.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM