0

I have a very simple app with an empty activity. I just tried it over another phone (the Huawei P8 Lite 2017 to be precise), and it seems that onCreate never appears in logcat. Here is the code for the activity ("Empty activity" app created through wizard, using android studio, which recently received a major update).

package com.test.test;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.v("foo","OnCreate");
    }
}

On every other phone I tried, it displays fine in logcat. On this phone I get a bunch of info/error messages (as usual I would say, but the messages are somewhat different), and no "OnCreate".
It works fine, for example, for the Galaxy S7 (running "7.0", just like the P8 Lite 2017).

Are there any adb settings that may hide this log from me? What could be the problem?

maxbc
  • 949
  • 1
  • 8
  • 18
  • 2
    Is this the same problem https://stackoverflow.com/questions/18124334/huawei-logcat-not-showing-the-log-for-my-app? – ישו אוהב אותך Dec 01 '17 at 17:49
  • If you put a breakpoint, does it get hit? Show your manifest file. Do you have the MainActivity configured properly as launch intent and default? – Sam Dec 01 '17 at 17:55
  • It seems that logging everything as Info `Log.i("foo","onCreate")` displays messages. I can't find settings in the phone that disable verbose logging. – maxbc Dec 04 '17 at 10:49

1 Answers1

1

As per ישו אוהב אות 's comment, it seems it's a Huawei feature : some (most?) logs are disabled by default. The method described in Huawei, logcat not showing the log for my app? works for me (menus are slightly different from what is in the answer, see comments).

Now verbose logs are showing out of logcat.

EDIT: after further testing, it seems the behavior of log activation feature is quite erratic on this phone (maybe other Huawei phones). I haven't been able to clearly understand what makes it work and what does not. I'm currently using the Log.i workaround.

maxbc
  • 949
  • 1
  • 8
  • 18