Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+9 votes

(A student asked this). The app keeps quitting unexpectedly when I run it -- how can I tell what is going wrong?

asked in CSC490_Spring2019 by (508 points)

1 Answer

+1 vote

In terms of your error, you should check the logcat view in Android Studio to find what specific error message you are getting when the program crashes. (e.g. is it a NullPointerException? on what line of your code is it happening?)

You can also print debugging information to the logcat similar to how you would with the console in Eclipse. Printing out values to logcat may help you figure out what is going wrong, and when.

Here's a tutorial that might help: https://www.101apps.co.za/articles/using-android-s-log-class-api-to-debug-android-application-code.html

answered by (508 points)