Changing the auto-generated Java files


  1. StevenHu

    StevenHu Well-Known Member

    Where do I make changes so the auto-generated R.java file in the /gen/ folder will be updated appropriately?

    package com.THIS-PART.AND-THIS-PART-NEEDS-TO-BE-CHANGED;

    public final class R {
    public static final class attr {
    }
    public static final class drawable {
    public static final int icon=0x7f020000;
    }
    public static final class layout {
    public static final int main=0x7f030000;
    }
    public static final class string {
    public static final int app_name=0x7f040001;
    public static final int hello=0x7f040000;
    }
    }

    Thanks!

    Advertisement
  2. cr5315

    cr5315 Well-Known Member Developer

    You can't change the generated files. Even if you do, it will revert back to what it generated.
  3. StevenHu

    StevenHu Well-Known Member

    Obviously, then, I'll have to start over. Is there any way to salvage what I have so far? I thought I could make one as a template and copy/paste to make a new one. That's not going to work?

    Thanks!
  4. pietjuhhh1990

    pietjuhhh1990 Well-Known Member

    Nope it won't work it will always be autogenerated and it is'nt a file you want to be messing wih. If you have an error that has deleated your R.java use project clean in the menu to get it back.

    Mostley if you have a problem with R.java you have a problem in an xml file
    StevenHu likes this.
  5. StevenHu

    StevenHu Well-Known Member

    Okay, thanks for saving me hours of tracking this down. I'll start from scratch and use my "template" for adding notes that explain what to do on each page.
  6. JamTheMan

    JamTheMan Well-Known Member

    Also - Changing the package name in the R. file, wouldn't that be done by changing it in the Manifest and making sure that the package actually exists in the source?
    StevenHu likes this.
  7. StevenHu

    StevenHu Well-Known Member

    You are right! That worked!
Loading...

Share This Page