开发者

Error resolving drawable resources in Android API Level 3

I'm developing an application that uses tabs and should be compatible with Android 1.5 (API Level 3).

Please see Tab icons compatibility between API level 3 and >=5. Basically I have two sets of tab icons as google recommends.

  • Tab icons for targets >= 5 are located in drawable-(h/m/l)dpi-v5.
  • Tab icons for targets < 5 and all other drawable resources are located in drawable-(h/m/l)dpi.
  • My AndroidManifest.xml has android:minSdkVersion="3" and android:targetSdkVersion="5".
  • I'm compiling using Level 7 SDK
  • All my code is Level 3 compatible

When running in a device/emulator >= Level 5 everything works correctly, tab icons are displayed ok using the -v5 resources. In a device Level 4 everything开发者_如何学JAVA also works ok, tab icons are also ok.

However, when using a device level 3 the app crashes when trying to resolve a drawable resource. The stack says something like this:

Caused by: java.io.FileNotFoundException: res/drawable/splash_background.xml
       at android.content.res.AssetManager.openXmlAssetNative(Native Method)
       at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:471)
       at android.content.res.Resources.loadXmlResourceParser(Resources.java:1825)

Note that res/drawable/splash_background.xml exists. This is one example, it throws the same error when trying to fetch any drawable resource.

Any clues on this?


The -ldpi, -hdpi and -mdpi qualifiers were added in API 4, so they don't work.

See Providing screen resource compatibility for Android 1.5.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜