user2137032
user2137032

Reputation: 73

importing R. (android)

I have searched through Stack Overflow as I know this is a common question, but none of the solutions seemed to work for me. This included cleaning my project, deleting all imports and deleting the project and starting again entirely.

I am using the Eclipse specifically for android on mac (ADT bundle mac).

Whenever I create a new project I have errors immediatley in my src folder on the line setContentView(R.layout.activity_main);

and also on inflate.

Any suggestions other than those stated? It is literally before I have done any programming so cannot understand what is wrong.

EDIT: Fixed. Downloaded the SDK a second time and this seems to have fixed it.

Upvotes: 5

Views: 43311

Answers (3)

nijas
nijas

Reputation: 1899

Change your Project Build Target to the Latest

Right Click Project > Properties > Android > Change the Api to latest version

Upvotes: 1

bob
bob

Reputation: 31

Try to update the Android_SDK. When you create or import a new Android project the SDk builds the project. The R problem is mostly an update SDK problem.

Upvotes: 0

stinepike
stinepike

Reputation: 54742

import The R class. The basic syntax is

import your_application_package_name.R;

If you have already imported it but it is not working then check if there in any error in your resource xmls. If so then r can be not generated and that error will be shown

Upvotes: 8

Related Questions