How do I fix this? I already tried removing the R.java and cleaning the project via eclipse, but it doesn’t help.
FYI I am trying to get PhotoStream from here: http://code.google.com/p/apps-for-android/, but so far it has been very difficult to get things work.
Okay….. 5 mins later google tells me the correct answer…
I just didnt search hard enough.
“The type R is already defined”
That’s the message you get in Eclipse if you try to build the Funambol Android Sync Client.
Reason is that you have checked two Builders that try to generate the same class.
You just have to uncheck the Java-Builder from Project->Properties->Builders.
Then the application even works fine in the Emulator.
Delete the R.java from the src folder and rebuild the project. This file will be automatically rebuit during this process.
- click right to project click properties
- unckeck java Builder
- delete file R.java
You may want to change your package names. It looks like you are using a ‘PhotoStream’.jar which has it’s R.class defined at the same package structure as you.
Here is a link to the R.java from the project on Google Code. Notice you are using the same package:
I had the same issue when I imported a project from work. Turning off the Java builder as suggested in the article you found fixed my problem, but when I made code updates they were not reflected in the running app. In my case there was an R.java in my source which I deleted and that fixed my problem.
In my case,
as i m not using any IDE for programming but using command line Android..
i had two xml files, one in layout and other in layout-land. i was using same id “XXX” for both but while declaring i made small mistake
android:id="@+id/XXX" (in layout xml) android:id="@+id/XXX " (in layout-land xml)
please observe extra space in second id declaration, so while creating R.java they were different and in R.java i had
public static final int XXX=0x7f040046; public static final int XXX =0x7f040045;
which are same, so please be aware of extra spaces. Thank you