AOSP layout xml 在eclipse中预览文件

AOSP layout xml file preview in eclipse

我按照 here 中的说明将整个 AOSP 项目导入到 Eclipse 中。我可以正确构建和 运行 项目。但是在我工作的过程中,有两个问题一直困扰着我。

  1. 我无法预览位于“/frameworks/core/res/res/layout/”的布局 xml 文件。当我在图形布局视图中打开 xml 布局文件时。我收到一些错误,例如:

No resources match the configuration

,,Locale Language__Region__, Left To Right, sw800dp, w1280dp, h800dp, Extra Large Screen, Not Round screen, Landscape Orientation, Normal, Day time, Medium Density, Finger-based touchscreen, Soft keyboard, No keyboard, Hidden navigation, No navigation, Screen resolution 1280x800, API Level 18

Change the configuration or create:
res/layout-ldltr-sw800dp-w1280dp-h800dp-xlarge-notround-land-notnight-mdpi-finger-keyssoft-nokeys-navhidden-nonav-1280x800-v18/mw_decor.xml

You can also click the "Create New..." item in the configuration dropdown menu above.

而且预览是空白的。到目前为止,每次更改 xml 内容并更新设备以查看结果时,我都必须 运行 构建。这真的很低效。我希望有一种方法可以预览 UI,就像我们在开发普通 Android 应用程序时所做的那样。

  1. 当我在 Eclipse 中打开一个 java 文件时,例如ActivityManagerService.java。我遇到了很多编译错误,这些错误是引用 "com.android.internal.R" 或其他一些常量的行。

我只是想知道有什么办法可以消除这些错误吗?因为这些真的很混乱,很难在文件中找到真正的错误行。

希望有人能给我一些提示或指示。非常感谢。

因为它使用 android.internals,您无法使用来自 Google 的 stock sdk 图像访问它。也尝试搜索如何使用 android.internals.

通过再次深入搜索,我发现了两个与我的问题相同的主题。他们只是给出了一些解释(没有解决方案)。

  1. Using ADT Layout Editor with Android platform source
  2. How to include com.android.internal.R into android.jar

但我仍然认为构建整个平台只是为了检查小部件是否在正确的位置会浪费大量时间,而且 ADT 的布局编辑器应该工作听起来很合理。如果有人有更好的主意,我将不胜感激。