Why are Log.d() and Log.v() not printing

前端 未结 10 2149
难免孤独
难免孤独 2020-12-10 10:15

I have the following test code in my Activity:

@Override
public void onStart() {
    super.onStart();
    Log.e(CLASS_NAME, \"ERROR onStart()\");
    Log.w(C         


        
相关标签:
10条回答
  • 2020-12-10 10:42

    I was trying everything. From log.d to log.wtf. But nothing worked.

    Then I restarted my Android Studio. After that, the debugger started working again.

    Hope this helps to someone.

    0 讨论(0)
  • 2020-12-10 10:45

    i had the same problem. I switched off and on developer options and usb debugging and all logs worked. i also enabled gpu debug layers in developer options(i dont think that helped).

    0 讨论(0)
  • 2020-12-10 10:48

    For me the issue was that I had actually disabled the logger buffer in my developer settings so go to Settings -> Developer options -> Logger buffer size and set it to anything that isn't 'off'.

    0 讨论(0)
  • 2020-12-10 10:49

    Turn off your Developer Option then Restart Your Phone After that on developer option It definitely works by sure!!

    0 讨论(0)
  • 2020-12-10 10:54

    I had similar problem to this one. However in my case the problem was empty first string. It worked in older version of Android Studio, but stopped working in Android Studio ver 5.6 after update. When I used: Log.d(string1, string2); in my logging wrapper class, then whenever string1 was "", the logcat would ignore it. The solution was to add

    if(string1 == null || string1 == "") {
        string1 = "defaultString";
    }
    

    before

    Log.d(string1, string2);
    

    I hope this helps anyone with this problem.

    0 讨论(0)
  • 2020-12-10 10:55

    Accepted answer not working

    My solution:

    when your Log.d is not working then Log.wtf is work

    It's working for me, may be this is helpful to other, who find solution

    0 讨论(0)
提交回复
热议问题