谷歌的Android存储库代码无法编译

时间:2014-05-25 15:15:39

标签: android calendar

我从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文件。你觉得怎么样?这个提交被检查了吗?

我应该使用什么而不是那些drawables?颜色黑?还是颜色红?解决此问题的最佳方法是什么?

如果Google不符合标准,谁会?

1 个答案:

答案 0 :(得分:2)

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

project.properties

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

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

这对应于platform/frameworks/opt/datetimepicker存储库中的位置。所以,如果你要查看该存储库:

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将修复您列出的前两个错误。

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

修改

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

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