开发者

Trying to get the Hello Android tutorial to work on Mac OS X Leopard

开发者 https://www.devze.com 2023-01-25 22:34 出处:网络
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 u

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 p开发者_如何学Gohone buttons on the right. I did not see the "Hello, Android" text from the tutorial.

Any ideas?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消