user2921883
user2921883

Reputation:

eclipse first loading error

I started a new project in eclipse android but there was a 3 errors in the beginning. I made a new project again but I had them again. There wasn't these errors before can anyone help ? these are first default codes main activity:

package com.persiansmarthome;

import android.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}

These are the errors:

Description Resource Path Location Type activity_main cannot be resolved or is not a field MainActivity.java /PersianSmartHome/src/com/persiansmarthome line 15 Java Problem

Description Resource Path Location Type main cannot be resolved or is not a field MainActivity.java /PersianSmartHome/src/com/persiansmarthome line 22 Java Problem

Description Resource Path Location Type Don't include android.R here; use a fully qualified name for each usage instead MainActivity.java /PersianSmartHome/src/com/persiansmarthome line 5 Android Lint Problem

Upvotes: 1

Views: 655

Answers (2)

VJ Vélan Solutions
VJ Vélan Solutions

Reputation: 6554

Remove this line:

import android.R;

from your MainActivity.java file

For more details, look at R cannot be resolved - Android error.

Upvotes: 1

ItayB
ItayB

Reputation: 11337

Try to increase the minimum sdk version in manifest.xm

Sounds like incorrect sdk / api version. Check also your sdk version in your project properties and make sure you installed the relevant sdks in sdk manager

Upvotes: 0

Related Questions