【问题标题】:Error after adding bitmap resource from the command line?从命令行添加位图资源后出错?
【发布时间】:2012-11-23 05:29:03
【问题描述】:

我正在通过 emacs/命令行为 Android 开发,我有一个简单的问题。我想添加一个位图资源并将其创建为ImageView。创建目录 res/drawable-ldpi 并添加 .png 会导致错误:

FATAL EXCEPTION: main

java.lang.RuntimeException: Unable to start activity

ComponentInfo{org.example.Application1.MainActivity}:

android.content.res.ResourcesNotFoundException: File res/drawable-ldpi/pic.png from xml

type layout resource ID #0x... {等}

编译过程中没有错误。运行 ant debug 会产生以下结果:

-snip-

[echo]----------

[echo] Handling Resources...

[aapt] Found Deleted Target File

[aapt] Generating resource IDs...

[echo]----------

-snip-

-crunch:

[crunch] Crunching PNG Files in source dir: C:\DEV\Application1\res

[crunch] To destination dir: C:\DEV\Application1\bin\res

[crunch] Processing image to cache: C:\DEV\Application1\res\drawable-ldpi\pic.png => C:\DEV\Application1\bin\res\drawable-ldpi\pic.png

[crunch] (processed image to cache entry C:\DEV\Application1\bin\res\drawable-ldpi\pic.png (87% size of source)

[crunch] Crunched 1 PNG file to update cache

-snip-

我发现的大多数 Android 帮助都涉及 Eclipse,我没有使用也不想使用它。还有什么我应该做的吗?

【问题讨论】:

    标签: android command-line android-resources


    【解决方案1】:

    原来drawable 是要使用的目录,而不是drawable-ldpi

    如果有人可以解释原因,我可以将其标记为答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-26
      • 1970-01-01
      • 2012-07-26
      • 1970-01-01
      • 2011-07-04
      相关资源
      最近更新 更多