Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Android Tutorial: Hello World

 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good afternoon, everyone:

Because mobile application are going so viral everywhere, I figured I better learn something quick. So, my journey starts with going to the Android Developers site http://developer.android.com/index.html and downloading the Android SDK.

Reading through the download information, I see the use of Eclipse the associated plug-in, great! I follow the instructions and go to build the Hello world example. I am now getting the following error:

2010-11-16 13:40:23 - HelloAndroid] ERROR: Unable to open class file D:\Galileo\workspace\HelloAndroid\gen\com\example\helloandroid\R.java: No such file or directory


Using Windows Explorer I get:
D:\Galileo\workspace\HelloAndroid\gen\com\example\helloandroid
where I find the file.

I am using Eclipse 3.5.2. Please Advise.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This same issue has bugged me about the Eclipse Android plugin. The is generated, but if it doesn't already exist then the build complains. Thge way I get around it is right-click the "gen" folder and create a new class, giving the appropriate package name ("com.example.helloandroid" in your case) and as the class name. Once the class is created, you should be able to build without errors. (Note that you do not have to, and should not, edit the file.)

Sorry for the formatting, but the forum prevents me from using that letter by itself.
 
Preston Thornton
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You know what, I found a silly work around to this issue. Go up to File -> Restart and then run the build and run the project. It works. Crazy.


Louis Preston Thornton III
A Flex 4 Wantabe
and Android Hopeful
 
James Elsey
Ranch Hand
Posts: 228
Android IntelliJ IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Preston,

I've had similar such behaviour in Eclipse. Sometimes eclipse may complain that your project "has errors" and can't compile, yet the source code can be ok.

Best solution I've found, is to "clean" the project. I can't remember where that option is (not in front of an IDE) but somewhere along the top you can go Projects > Clean, I believe

Try that, it might help

Cheers
 
Chan Vysnow
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, man!

Every time I create a project, this problem happens to me. I think it's nomal. For Eclipse read R.java before the IDE had generated it, it would happen.

Hope to help.

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[I found a silly work around to this issue. Go up to File -> Restart and then run the build and run the project. It works.

I just tried this and it didn't work for me. Here are the step I took:
1) Create a new Android project
2) File | Restart
3) Right-click project and select Build.
Still got the error:



If course, my suggested workaround fixed this.
 
Lars Vogel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In most cases cleaning the project should fix the issue, please see Fixing Issues with the Android SDK for details.
 
Patrick Blais
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I've just downloaded Eclipse and installed the Android SDK.

When I try to run the Hello World, I get the following error message

[2010-12-11 13:06:38 - Tutoriel] /Tutoriel/gen already exists but is not a source folder. Convert to a source folder or rename it.
[2010-12-11 13:08:57 - Tutoriel] /Tutoriel/gen already exists but is not a source folder. Convert to a source folder or rename it.
[2010-12-11 13:09:06 - Tutoriel] /Tutoriel/gen already exists but is not a source folder. Convert to a source folder or rename it.

I don't know what to do with this?

I've tried a couple of things but it seems the gen folder is always in the way when trying to run the app.


What am I not understanding here?
 
Lars Vogel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try the solultions from the link I posted?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic