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

前端 未结 10 2161
难免孤独
难免孤独 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: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.

提交回复
热议问题