1

It's my 3rd day in Android dev. Just now my app. was working fine but instatntly all refrences to my R file started showing error. It was working fine couple of mins back.

Even the code like below , generated by ADK was working fine and now it shows the error

Code Snipppet:

@Override
        public CharSequence getPageTitle(int position) {
            Locale l = Locale.getDefault();
            switch (position) {
            case 0:
                return getString(R.string.title_Venue).toUpperCase(l);
            case 1:
                return getString(R.string.title_Teams).toUpperCase(l);
            case 2:
                return    getString(R.string.title_WeatherConditions).toUpperCase(l);
            }
            return null;
        }

Tried cleaning and rebuilding the soluition , no luck.

Kindly help.

Lalit

Lalit_vicky
  • 295
  • 1
  • 5
  • 15
  • can you post your `...android.R` import here please? – Lia Pronina Aug 28 '13 at 08:15
  • Try to remove the errors in your layout files if there are existing and try to clean project (in Eclipse : Project -> Clean), your R file will be regenerated. Don't forget to check the import (android.R != yourpackage.R) – Sw4Tish Aug 28 '13 at 08:17
  • Make sure you don't have errors in any of your resources XML files or your AndroidManifest.xml file. If an error is present in any of these, the project will not build and the R file will not be generated. – Aleks G Aug 28 '13 at 08:17
  • Check if you have any errors in your resource files. If you have any R.java won'r be generated. Check if you have imported android.R if so remove it. You should have reference to your R.java in your which is in gen folder – Raghunandan Aug 28 '13 at 08:17
  • My manifest and layout files are ok.. i have a namespace import android.R; thats generated default by the ADK. is thats the cause? – Lalit_vicky Aug 28 '13 at 08:25
  • The link is what i followed and solved the issue... http://stackoverflow.com/questions/15309941/import-android-r-in-eclipse-why ..just by deleting the import android.R; .. it really sucks to the beginner for such tasks by ecllipse.. BTW thanks guys for your quick responses. – Lalit_vicky Aug 28 '13 at 08:33
  • clean & rebuild your project ! – Rachit Mishra Aug 28 '13 at 08:36

1 Answers1

2

import should look like this:

import your.package.name.R;

and check xml files for errors please

Lia Pronina
  • 766
  • 3
  • 7