Vishnu C Vishnu C - 1 year ago 85
Android Question has errors in android studio

I installed android studio in ubuntu recently and I'm pretty new to linux. I built an app that uses a switch widget. The problem is, when I tried to access the switch object using

Switch switch = (Switch) findViewByID(;

I got an error saying that it is not a valid statement along with multiple errors like '(' expected, right after the the object name, the second word in the line, 'switch'

Out of curiosity, I went to by ctrl clicking the class name. And over there I found over 72 errors.

This is what it looks like:

73 errors in

I have downloaded the latest google APIs after seeing the response to this question. And I still don't know how to rectify it. I am asking this question here as a last resort. It most probably will be some silly mistake on my part while configuring the install. Please help me!

Answer Source

switch is a Java language keyword so you can't use it as a variable name.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download