【问题标题】:Aapt tool chokes on a brand new Android projectAapt 工具扼杀了一个全新的 Android 项目
【发布时间】:2011-04-16 00:01:52
【问题描述】:

此行为已在命令行和 Eclipse 新项目中重现。我什么都没碰过。

aapt p -M AndroidManifest.xml -S res -v
Locale/Vendor pairs:
   /
   /
   /
   /

Files:
  drawable-hdpi/icon.png
      Src: res/drawable-hdpi/icon.png
  drawable-ldpi/icon.png
      Src: res/drawable-ldpi/icon.png
  drawable-mdpi/icon.png
      Src: res/drawable-mdpi/icon.png
  layout/main.xml
      Src: res/layout/main.xml
  values/strings.xml
      Src: res/values/strings.xml
  AndroidManifest.xml
      Src: AndroidManifest.xml
applyFileOverlay for drawable
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
    (new resource id icon from res/drawable-hdpi/icon.png)
    (new resource id icon from res/drawable-ldpi/icon.png)
    (new resource id icon from res/drawable-mdpi/icon.png)
    (new resource id main from res/layout/main.xml)
res/layout/main.xml:2: error: No resource identifier found for attribute 'orientation' in package 'android'
res/layout/main.xml:2: error: No resource identifier found for attribute 'layout_width' in package 'android'
res/layout/main.xml:2: error: No resource identifier found for attribute 'layout_height' in package 'android'
res/layout/main.xml:7: error: No resource identifier found for attribute 'layout_width' in package 'android'
res/layout/main.xml:7: error: No resource identifier found for attribute 'layout_height' in package 'android'
res/layout/main.xml:7: error: No resource identifier found for attribute 'text' in package 'android'

在 64 位 Ubuntu 上运行带有 2.3.3 SDK 的 Android Platform-Tools 版本 3。

感谢您的帮助!非常感谢!

【问题讨论】:

  • 当您让 Eclipse 或 ant 执行它们的正常构建过程时会发生什么,包括它们对 aapt 的调用?
  • 我们可以看看 res/layout/main.xml 吗?

标签: android aapt


【解决方案1】:

您不包括 Android 框架资源。将 -I 选项与查找框架资源 .apk 的路径一起使用。

【讨论】:

  • 就是这样。 aapt 的文档说“-I add an existing package to base include set”,这几乎是模糊和不透明的。他们实际上是在寻找特定平台的 android.jar,它不是生成的项目代码的一部分。只是给像我这样的其他新手的注释。
【解决方案2】:

我也遇到了这个错误。我的解决方案是在必填字段或变量中填写完整路径和 android jar 的名称。如果 aapk 找不到它,这是它报告的错误消息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-05
    • 2014-12-27
    • 1970-01-01
    • 1970-01-01
    • 2014-12-14
    • 2019-08-12
    • 2023-03-22
    • 1970-01-01
    相关资源
    最近更新 更多