Type R is already defined error

前端 未结 6 796
伪装坚强ぢ
伪装坚强ぢ 2020-12-06 06:23

\"enter How do I fix this? I already tried removing the R.java and cleaning the project via ec

相关标签:
6条回答
  • 2020-12-06 06:40

    Delete the R.java from the src folder and rebuild the project. This file will be automatically rebuit during this process.

    0 讨论(0)
  • 2020-12-06 06:40

    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: http://code.google.com/p/apps-for-android/source/browse/trunk/Photostream/src/com/google/android/photostream/R.java?r=83

    0 讨论(0)
  • 2020-12-06 06:44

    Okay..... 5 mins later google tells me the correct answer...

    http://www.fairtec.at/en/it-blog-mainmenu-16/168-the-type-r-is-already-defined

    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.

    0 讨论(0)
  • 2020-12-06 06:49

    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.

    0 讨论(0)
  • 2020-12-06 06:56

    http://www.fairtec.at/en/it-blog-mainmenu-16/168-the-type-r-is-already-defined

    1. click right to project click properties
    2. Project->Properties->Builders.
    3. unckeck java Builder
    4. delete file R.java
    0 讨论(0)
  • 2020-12-06 07:02

    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

    0 讨论(0)
提交回复
热议问题