My R.Java is not generating may and project is not building using actiobarsherlock library

StackOverflow https://stackoverflow.com/questions/23136428

  •  05-07-2023
  •  | 
  •  

Question

package com.yogeshbalan.myrootguide.appguide;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


public class MainActivity extends ActionBarActivity {

@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;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

}

this is my MainActivity and showing error 'Cannot resolve R to it's type ' whenever i add actionbarsherlock library in my project it doesn't build, but build after removing the library.

the error is

Error Paste Bin

Was it helpful?

Solution

This error is usually caused by either of these possibilities:

  • The most probable: You have a syntax error in any of your layout files (i.e., the files located under the res\layout folder of your project). The bad thing of this is that Eclipse won't warn you and tell you what's the error, so you'll have to go one by one looking for the syntax (probably an unmatched tag, an unmatched attribute, etc.) and fix the issue.

  • The other possibility is a syntax error within your AndroidManifest.xml file. Same goes here, check it for syntax errors.

One of these two will fix your issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top