生成的 R 上的冲突

发布于 2024-12-06 21:41:34 字数 1053 浏览 0 评论 0原文

我正在将一些 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

影子是时光的心 2024-12-13 21:41:34

检查导入列表,可能存在包名称过时或名称中带有“R”的导入。

Check the import list, there might be an import with an outdated package name or with "R" in the name.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文