Ebad Saghar
Ebad Saghar

Reputation: 1127

Getting a weird Android error in my R class

I can't export my project to make an apk because of an error in my gen->com.example.project->R.java class. Here's the snippet of code where the error lies in:

public static final class drawable {
        public static final int 512=0x7f020000;
        public static final int ic_launcher=0x7f020001;
        public static final int mr_excuse=0x7f020002;
    }

The very first line, the 512, that is where the error is. I have no idea where that 512 comes from. I tried editing the file and deleting that entire line, but when I try to save it I get a message saying:

[2014-02-23 10:45:02 - MrExcuse] R.java was modified manually! Reverting to generated version!

I have no idea what this message is for. I just want to remove the error.

Upvotes: 1

Views: 109

Answers (2)

Ebad Saghar
Ebad Saghar

Reputation: 1127

I figured it out. I checked my drawable file paths and deleted a picture called 512. It solved the problem.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1500225

It looks like you've tried to define a resource with an ID of 512. You can't do that - it's not a valid identifier.

Look at the piece of your XML where you've defined ic_launcher and mr_excuse, and look for 512 near that... then give it a proper name.

Upvotes: 6

Related Questions