0

I made a very simple "hello world" displaying code in Android but encounter with these problems:

activity_main cannot be resolved to variable and R cannot be resolved to a variable. I went with following approaches:

1) clean and build the project.

2) added import com.example.Myapp.R (myapp is my my projects name).

Could any one suggest what should i do now?

Voicu
  • 16,921
  • 10
  • 60
  • 69
B166ER
  • 11
  • 1
  • 4

2 Answers2

0

It may be caused in about problem in your resources,probable your layouts.For example you may use a widget in your layouts that is not defined in your project's Android version.If there is no such error,clear gen folder and try "Run as Android Application".Also it may be useful to change an "ID" of a widget in any layout or add a new widget with new ID to layout then save and do clean/build project or reopen your IDE.

hasanghaforian
  • 13,858
  • 11
  • 76
  • 167
0

-. Make sure there is no Error in the project

-. Make sure that the project properties exist and Android min SDK linked to existing SDK

-. Delete bin/ and gen/ folder in your project

-. Clean and build again

Zennichimaro
  • 5,236
  • 6
  • 54
  • 78