Kumar Ashish Kumar Ashish - 1 year ago 93
Android Question

Cannot resolve symbol "Hello World" error,right after I started a new project

What's my Problem : I started app development using android studio today and I can't seem to get past the first part. The content after android:text=" in content_main.xml is always in red and it is being referred to as an error, even when I'm not referring to the strings.xml.

What all did I try : I read up on previous answers and I read that there must be something wrong with my xml file, that I might have messed up something which should have been there. I tried clean/rebuild. Then I deleted this project and started a new one but the problem didn't go.

SURPRISINGLY THOUGH, removing tools.context=".MainActivity" solved it.

What I want to know : Is it ok for me to continue working without the tool.context . I mean I have no idea what it does and what exactly is causing the problem. I would love to know a proper fix.

Here I am attaching the image for my xml file.

EDIT: I realised that without the tools.context, nothing would show up on the AVD. So I really need a fix.

Answer Source

It is perfectly fine for you to continue developing without the tools:context attribute, this is only used at design time and it will ignore when you build your APK as shown in this post.

You haven't really solved the issue on the second image btw, you have a bad formed XML and your project won't compile.

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