Search code examples
javaandroidlogcat

Android Studio won't recognize Log.e


I'm a new programmer and I'm learning java for android development. The problem is when I use Log.e in Android Studio it says:

can not resolve symbol e

I wrote import android.util.Log; in first line of my program but it still doesn't work. I also tried restarting android studio, restarting LogCat, creating a new project, restarting the system and launching android emulator then code but it still doesn't work.

Screen Shot


Solution

  • Try again inside some function. You write it in class, so Android studio thinks that Log.e is type definition.