Android debugging?

What is the best way to debug an Android application? From time to time, the application crashes, it says that the application unexpectedly stopped, it never says why it crashes, or where in my code, which way to bid to find the cause of crashes and exceptions?

+3
source share
4 answers

There are several ways to do this, activate LogCat and you will see detailed information about what is happening with your application.

or you make a mistake. Handling Exception Information Toast

 try {
    ...
    your code
    ...
 } catch (IOException e) { 
     Toast.makeText(getApplicationContext(), "Exception Info " +     e.getCause(),Toast.LENGTH_LONG).show();
    e.printStackTrace();
 }      

updated

+4
source

ADB, , / . stacktrace Logcat , .

+4

Android Log logcat, :

Log.d( " ", " x :" + x);

- :

D/ (1001): x : 96

, : "adb logcat" Dalvik (ddms Android SDK)

, , , logcat (, , )

0

You can also catch logs using the DDMS tool using android. Just enter DDMS in cmd and it will show you a GUI with running logs and other debugging materials.

0
source

Source: https://habr.com/ru/post/1753914/


All Articles