生成的 R 上的冲突
我正在将一些 Android 项目集成到其中。
这类似于:
(Lib 项目) Android_Commons 富读者 面部识别器 WWReader
主项目是 ReaderShelf,并将所有这些项目作为库添加到其路径中。
但链接的源代码出现编译错误,在 R 类上找不到库中的 id。
我打开了所有R文件,它们是所有原始R文件的合并。
但是从源打开时会出现错误:
searchButton = (Button) findViewById(R.id.r_search);
sectionsButton = (Button) findViewById(R.id.r_sections);
navigateButton = (Button) findViewById(R.id.r_navigate);
他们打开正确的文件,但没有 r_sections & r_navigate。
PS:不给出错误的 r_search 也是主项目上出现的常见 id
实际上,我发现了另一个奇怪的行为,注释有问题的行,代码编译,但打开时,DPReaderActivity 在所有 findViewById 上返回 null 。
编辑: 我看到了构建项目的日志,我发现了这个,我不知道是否有帮助
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_favorites.png
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_library.png
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_navigate.png
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_search.png
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_sections.png
I has some Android projects that I'm integrating on one.
This is something like:
(Lib projects)
Android_Commons
RichReader
FacReader
WWReader
The main project is ReaderShelf, and add all those projects as library on it's path.
But the source linked presents compilation errors, the ids from the library cannot be found on the R class.
I opened all the R files, and they are a merge of all the original R files.
But when opening from the source that give error:
searchButton = (Button) findViewById(R.id.r_search);
sectionsButton = (Button) findViewById(R.id.r_sections);
navigateButton = (Button) findViewById(R.id.r_navigate);
They open the correct file but without the r_sections & r_navigate.
PS: r_search that don't give error is a common id that is presented on the Main project as well
Actually, I found another weird behavior, commenting the problematic lines, the code compiles, but when opening, the DPReaderActivity returns null on all findViewById.
Edit:
I saw the log building the project and I found this, I don't know if it helps
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_favorites.png
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_library.png
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_navigate.png
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_search.png
[2011-09-26 18:36:21 - ReaderShelf] trying overlaySet Key=r_sections.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查导入列表,可能存在包名称过时或名称中带有“R”的导入。
Check the import list, there might be an import with an outdated package name or with "R" in the name.