1

In Google Play Console on the dashboard of your application there is a graph with Crashes & ANRs.

What is the best practice to solve crashes to provide the best service to your users? My application is written in Python in Kivy framework.

xralf
  • 3,312
  • 45
  • 129
  • 200
  • 1
    I've seen people use [Sentry](https://sentry.io/welcome/) for this, by adding it to the Python code as you normally would. – inclement Mar 29 '21 at 18:26

1 Answers1

1

Navigate to Quality -> Android Vitals -> Crashes and ANRs.

This lists each event and on the right you will see a "->" arrow labelled "View Details". Click this, scroll down past the graph and you'll see the Stack traces.

This is what you need to look at to fix your code.

The top line will be the error, then it'll show the line of code where the error occurred, for example: [code]

java.lang.NullPointerException: 
  at com.test.MyApp.doSomethingCool (MyClass.java:123)
  at com.test.MyApp.somethingElse (AnotherClass.java:321)

[/code]

Here you have some null value causing an issue in the "doSomethingCool" function of your app and that code should be on line 123 of "MyClass.java". The trace lines after that show what called that function that failed, so above, this is showing that "doSomethingCool" was called from function "somethingElse" on line 321 and that code is in "AnotherClass.java".

This example is for Java.

--Updated--

If you are coding in Python, then the stack trace may not show you where in your own code the problem lies. Instead your best bet is to search on Google for the top line error and hope that the answer is online.

Separately from stack trace analysis I would highly recommend that you place your project into source control with GIT or SVN, specifically so that you can see what changes might have caused an error.

Update your code in the repository only when it's working and then you will always have a safe saved version that is known as working. You can then easily compare your current code and see what changes might have caused an error. This is especially useful for Android, which regularly updates versions of shared libraries.

James
  • 620
  • 3
  • 13
  • Thank you. I have two crashes with he type abort. The stacktrace looks like this `*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** pid: 0, tid: 0 >>> org.myapp.myapp <<< backtrace: #00 pc 000000000006f06c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) ... #00 pc 000000000022c4ec /data/app/org.myapp.myapp-yJuKYKwF0PZIMLhjmU_khQ==/lib/arm64/libpython3.8.so (offset 0x100000) (Py_Exit+32)` Can I do something with it? – xralf Apr 03 '21 at 22:16
  • Paste in the whole stacktrace. Use the {} icon and it'll get formatted correctly. The ".so" files are compiled binaries, you want to go down the stack trace until you find something that's in your own code. – James Apr 04 '21 at 02:05
  • [This](https://pastebin.com/48HxwNYt) is whole stacktrace. It does not display my code. – xralf Apr 04 '21 at 08:57
  • It looks like you can't actually find out which part of your own code is causing the issue with python, which makes things much harder. Instead I googled the first part of your stack trace "/apex/com.android.runtime/lib64/bionic/libc.so (abort+160)" to see if others had the same issue. It looks like the Facebook SDK is the issue. Check this link: https://stackoverflow.com/questions/63047553/apex-com-android-runtime-lib64-bionic-libc-so-abort160-abort-crash-in-andro – James Apr 04 '21 at 16:34
  • Thank you, it's interesting I don't use any facebook API or something in my code. – xralf Apr 04 '21 at 17:57
  • 1
    I think your best bet then is to try and re-create the crash while running the app on your own machine. Above the stack trace it will tell you what device it was running on. You can set up an AVD (Android Virtual Device) with the same OS specs and do extensive testing. – James Apr 05 '21 at 13:50