0

I've started learning java with android studio. I am currently facing this error when I am trying to implement the lifecycle functions, it gives me error that it cannot find symbol log.i

Here is the code.

package com.kdev.myapplication;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        log.i("LifeCycle: ", "onCreate()");
    }

    @Override
    protected void onStart() {
        super.onStart();
        log.i("LifeCycle: ", "onStart()");
    }

    @Override
    protected void onStop() {
        super.onStop();
        log.i("LifeCycle: ", "onStop()");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        log.i("LifeCycle: ", "onDestroy()");
    }

    @Override
    protected void onPause() {
        super.onPause();
        log.i("LifeCycle: ", "onPause()");
    }

    @Override
    protected void onResume() {
        super.onResume();
        log.i("LifeCycle: ", "onResume()");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        log.i("LifeCycle: ", "onRestart()");
    }
}
ocos
  • 1,901
  • 1
  • 10
  • 12
  • You should use `Log.i(tag, "log data ...");` with uppercase `L`. Please also `import android.util.Log;` – ocos Sep 21 '22 at 17:48

0 Answers0