0

I'm on Mac OS X Leopard and installed the ADT plugin into Eclipse Galileo. I followed all the steps on the Android developer SDK page to get started. My SDK version is 2.2 API 8 revision 2 and I just used the Hello World tutorial found here:

http://developer.android.com/resources/tutorials/hello-world.html

When I first created the Android application, I saw this error in the Eclipse console:

[2010-11-13 18:20:43 - HelloAndroid] ERROR: Unable to open class file / Users/mydirectory/Documents/workspace/HelloAndroid/gen/com/example/ helloandroid/R.java: No such file or directory

I commented out this line to fill in the few lines from the tutorial:

setContentView(R.layout.main);

When I ran the app, it launched my emulator but all I saw was a vertical screen on the left that said "ANDROID" and phone buttons on the right. I did not see the "Hello, Android" text from the tutorial.

Any ideas?

2 Answers2

1

Run project clean to force R.java generation.

Project -> Clean... -> OK

This should make the SDK to build your project correctly. Same problem happens to me pretty often with new projects.

Juhani
  • 5,076
  • 5
  • 33
  • 35
0

The Eclipse ADT plugin auto-generates the R.java file based on the XML files in the res/ folder. If there's an error in one of those XML files, then the R file won't be generated. So check to see if Eclipse detects any errors in your resource XML files.

Josh Clemm
  • 2,966
  • 20
  • 21