-1

I know that if you write something wrong in code you get a red underline.

My problem is that the whole word turns red and I get the error

"Cannot resolve symbol '(and then whatever the code is)'"

when I hold the mouse over it.

I have downloaded Java just to see if it were the problem. I also followed this tutorial on how to download Android studio.

The program I made is from this tutorial on Youtube.

The path text in the top gets a red underline.

I don't know if it helps but i'm using Windows 10 and Android Studio 3.3

Here you can see my code turning red:

Jason Aller
  • 3,541
  • 28
  • 38
  • 38

1 Answers1

1

You're writing Kotlin in a Java file. Because of this, your IDE doesn't understand the symbols you're using to define variables. Note that even more recent versions of Java don't support val, which is why I presume you're attempting to use Kotlin here.

Your choice: write your code in either Kotlin or Java, but not both at the same time.

Makoto
  • 104,088
  • 27
  • 192
  • 230