【问题标题】:Google's Android repository code cannot be compiledGoogle 的 Android 存储库代码无法编译
【发布时间】:2014-05-25 15:15:39
【问题描述】:

我从Android repository 下载了一个应用程序(日历)。

我试图编译它,但它给了我错误。

作为一名开发人员,我学到的关于存储库的第一条规则是:

提交你的代码,如果它可以无错误地编译。

编译时出现以下错误:

Error:(38, -1) android-apt-compiler: [Calendar] C:\Dev\Calendar\res\layout\location_dropdown_item.xml:38: error:  Error: No resource found that matches the given name (at 'textColor' with value '@drawable/list_item_font_primary'). 
Error:(46, -1) android-apt-compiler: [Calendar] C:\Dev\Calendar\res\layout\location_dropdown_item.xml:46: error: Error: No resource found that matches the given name (at 'textColor' with value '@drawable/list_item_font_secondary').    
Error:(44, -1) android-apt-compiler: [Calendar] C:\Dev\Calendar\res\layout\recurrencepicker.xml:44: error: Error: No resource found that matches the given name (at 'background' with value '@color/white').

确实,drawable 包中缺少提到的 xml 文件。你怎么看:这个提交被检查了吗?

我应该用什么来代替那些drawable?颜色:黑色?还是红色?解决此问题的最佳方法是什么?

如果 Google 不遵守标准,谁会遵守?

【问题讨论】:

  • 这种困境可能是部分结帐的结果。当我通过本地 svn 服务器检查我的项目时,我的本地库总是丢失。
  • 在网站上,它只显示了这个 Git 链接,没有提到额外的依赖:git clone android.googlesource.com/platform/packages/apps/Calendar
  • 您是否按照文档说明构建了整个源代码树?
  • 整个源代码树是什么意思?我从那个 Git 链接导入了整个包。而且我找不到任何文档,它只是简单的源代码。

标签: android calendar


【解决方案1】:

我认为Justin Jasman is hinting at 是构成 Android 源代码的各个存储库并非旨在自行检出和构建。它们被设计为作为整个 Android 源代码树的一部分构建,它将在构建过程中引入依赖项:

AOSP: Downloading and Building

话虽如此,您可以通过查看project.properties 文件获得有关任何外部依赖项的一些提示。例如,在该文件的顶部附近,您会看到以下行:

android.library.reference.1=../../../frameworks/ex/chips

对应于platform/frameworks/ex 存储库中的位置。因此,如果您要查看该存储库:

git clone https://android.googlesource.com/platform/frameworks/ex

查看 ex/chips/res/drawable 文件夹,您会发现一些可能有用的文件:

list_item_font_primary.xml
list_item_font_secondary.xml

将这些文件复制到 res/drawable 将修复您列出的前两个错误。

同样,关于第三个错误,您可以在platform/frameworks/opt/datetimepicker 存储库中找到该错误的资源。或者您可以将值从 @color/white 更改为 @android:color/white
(https://stackoverflow.com/a/3964048/399105)

编辑:

我刚刚注意到 Android 源代码库中的一些应用没有 project.properties 文件。在这种情况下,您可以只查看 Android.mk 文件,例如(来自platform/packages/apps/Mms):

chips_dir := ../../../frameworks/ex/chips/res

【讨论】:

  • 谢谢,对结账流程的解释很透彻。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多