R.java 文件背后的魔法

最近我在使用 R.java 文件时遇到了一些问题.现在我决定做一个备份并删除文件,看看会发生什么.

Recently I have been having quite some problems with R.java file. Now I have decided to do a backup and delete the file to see what happens.

什么都没有发生,所以我创建了一个空的 R.java 文件并希望一切顺利.现在 Eclipse 似乎发现文件被篡改了,甚至发出警告:

Nothing happened, so I created an empty R.java file and hoped for the best. Now Eclipse seems to figure out that the file was tampered with and even issues a warning:

R.java was modified manually! Reverting to generated version!

仅此而已.我尝试手动构建它,但没有得到任何结果.

And that's all there is. I tried building it manually but got no results.

所以,我有两个问题:

  1. 我应该怎么做才能强制 Eclipse 重新生成文件
  2. 这里发生了什么?文件是如何创建的,生成文件的代码在哪里?

如果有任何帮助,我将不胜感激.像往常一样,问题发生在截止日期前几天:)

I would appreciate any help. As usual the problem occurred just a few days before the deadline :)

推荐答案

我发现了问题 - 我创建了一个 9patch 图像,其中补丁区域仅在 Y 轴上定义(我试图防止在另一个上调整大小).

I found the problem - I have created a 9patch image with the patch area defined only on the Y axis (I was trying to prevent resizing on the other one).

问题仍然存在:为什么没有关于错误的警告?或者如果有 - 它被埋在哪里?

The question remains: Why isn't there a warning about the error? Or if there is - where is it buried?

相关文章