1

I am writting a class in eclipse for android and i am having problems with my R.layout.main.

public class createplayer extends Activity{

    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.createplayer);//problems with R

    }
}
Squonk
  • 48,735
  • 19
  • 103
  • 135
Jack welch
  • 1,707
  • 4
  • 25
  • 29
  • Which version of the Android SDK are you using? I get this problem with all versions, but it appears to happen less with more recent versions. – ThomasW Mar 02 '12 at 00:39

3 Answers3

2
  1. Like user717572 said. Try cleaning your project, sometimes things get messed up
  2. Check your imports; remove import android.R, the problem is that Eclipse is looking for Android.R.layout.main instead of com.your.package.R.layout.main. So another alternative to is to replace import android.R with import com.your.package.R if removing it doesn't solve your problems.
  3. And then of course make sure you have a layout called createplayer
Rawr
  • 2,206
  • 3
  • 25
  • 53
0

Check your imports for import android.R and remove it. And otherwise try project->clean.

user717572
  • 3,626
  • 7
  • 35
  • 60
0

What kind of problems are you having?

Cleaning your project may do the trick.

Otherwise, if R is not being created, there is probably an aapt error in parsing your xml files. You can manually run:

aapt package -m -v -J <path to your gen folder>/gen -M <path to your manifest>/AndroidManifest.xml -S <path to your res folder>/res -I <path to your android-sdk>/platforms/android-5/android.jar

This will list out where the problems are if your IDE is not telling you.

Shellum
  • 3,159
  • 2
  • 21
  • 26
  • from the command line... if you're using eclipse, you should see the exact command you need scroll by in the console. You can copy that into a dos/linux command prompt/terminal to run it. – Shellum Mar 02 '12 at 00:40