图片资源添加出现问题: No resource found that matches the given name
2013-09-05 14:30
507 查看
今天必须要吐槽一下了,折磨了人接近两天啊,多亏了技术主管(大力感谢王公子啊)!
有一个项目是将eclipse里面开发完毕的软件移植到项目中,在Eclipse中编译通过了,移植到项目过程中发现编译出现下面的错误。(很大量的错误下面仅为部分错误)
packages/apps/Contacts/res/layout-sw580dp-w1000dp-land/dialpad.xml:48: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/dial_num_4').
packages/apps/Contacts/res/layout-sw580dp-w1000dp/dialpad_additional_buttons.xml:18: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/dialpad_background').
packages/apps/Contacts/res/layout-sw580dp-w1000dp/dialpad_additional_buttons.xml:18: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/dialpad_background').packages/apps/Contacts/res/layout/dialog2.xml:69:
error: Error: No resource found that matches the given name (at 'textCursorDrawable' with value '@drawable/cursor_icon').
packages/apps/Contacts/res/xml/common_icon.xml:37: error: Error: No resource found that matches the given name (at 'IconDrawable' with value '@drawable/konka_preview_contacts').
packages/apps/Contacts/res/menu-sw580dp-w720dp/view_group.xml:38: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_menu_trash_holo_light').
这些资源都在项目中有,但是为什么会出现这样的错误,开始以为是编译没有清楚或者编译选项的问题,各种折腾,没有找到原因。
后来主管过来一看,先看log,找到最先出问题的log,有可能是一个问题导致了其他这么多问题。这个是有可能的。后来找到这个错误:
ERROR: Failure processing PNG image packages/apps/KonkaContacts/res/drawable-hdpi/feature_guide_1.png
libpng error: Not a PNG file
ERROR: Failure processing PNG image packages/apps/KonkaContacts/res/drawable-hdpi/feature_guide_2.png
实际上,这两个文件在当时项目中是测试文件,并没有用到,但是移植的时候一起移植过去了。删除它们之后,编译。就可以了。。。。。真是吐槽不能啊,所以千万不要将jpg的文件改后缀就用啊,会导致png解码失败啊有没有!!
需要注意:
1. 先不要看是否是编译环境出的问题。毕竟是添加了自己的代码之后才出现问题的,所以应该是引入的问题。
2. 出问题不要慌,要看log文件,因为在哪些地方出了问题一定会打印在log文件里面。
3. 先要找到第一个出问题的点,不要一下拉到最后面。平常都是直接拉到log文件的最后看问题点,但是如果找不到或许就要考虑从头开始看是哪个地方首先出错了。也许后面的问题就不是问题了。
有一个项目是将eclipse里面开发完毕的软件移植到项目中,在Eclipse中编译通过了,移植到项目过程中发现编译出现下面的错误。(很大量的错误下面仅为部分错误)
packages/apps/Contacts/res/layout-sw580dp-w1000dp-land/dialpad.xml:48: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/dial_num_4').
packages/apps/Contacts/res/layout-sw580dp-w1000dp/dialpad_additional_buttons.xml:18: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/dialpad_background').
packages/apps/Contacts/res/layout-sw580dp-w1000dp/dialpad_additional_buttons.xml:18: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/dialpad_background').packages/apps/Contacts/res/layout/dialog2.xml:69:
error: Error: No resource found that matches the given name (at 'textCursorDrawable' with value '@drawable/cursor_icon').
packages/apps/Contacts/res/xml/common_icon.xml:37: error: Error: No resource found that matches the given name (at 'IconDrawable' with value '@drawable/konka_preview_contacts').
packages/apps/Contacts/res/menu-sw580dp-w720dp/view_group.xml:38: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_menu_trash_holo_light').
这些资源都在项目中有,但是为什么会出现这样的错误,开始以为是编译没有清楚或者编译选项的问题,各种折腾,没有找到原因。
后来主管过来一看,先看log,找到最先出问题的log,有可能是一个问题导致了其他这么多问题。这个是有可能的。后来找到这个错误:
ERROR: Failure processing PNG image packages/apps/KonkaContacts/res/drawable-hdpi/feature_guide_1.png
libpng error: Not a PNG file
ERROR: Failure processing PNG image packages/apps/KonkaContacts/res/drawable-hdpi/feature_guide_2.png
实际上,这两个文件在当时项目中是测试文件,并没有用到,但是移植的时候一起移植过去了。删除它们之后,编译。就可以了。。。。。真是吐槽不能啊,所以千万不要将jpg的文件改后缀就用啊,会导致png解码失败啊有没有!!
需要注意:
1. 先不要看是否是编译环境出的问题。毕竟是添加了自己的代码之后才出现问题的,所以应该是引入的问题。
2. 出问题不要慌,要看log文件,因为在哪些地方出了问题一定会打印在log文件里面。
3. 先要找到第一个出问题的点,不要一下拉到最后面。平常都是直接拉到log文件的最后看问题点,但是如果找不到或许就要考虑从头开始看是哪个地方首先出错了。也许后面的问题就不是问题了。
相关文章推荐
- unity3d导入jar包发布出现错误No resource found that matches the given name 'Theme.AppCompat.Light'.
- 解决 No resource found that matches the given name (at 'icon' with value '@drawable/icon') 问题
- 在相对布局中出现:No resource found that matches the given name
- Android问题集锦之二十一:No resource found that matches the given name
- 升级android sdk到5.0时,创建项目出现错误:No resource found that matches the given name 'android:Widget.Material.A
- Unity与Android交互:使用Unity打包出现了:No resource found that matches the given name“Theme.AppCompat.Light”的错误
- 导入安卓工程出现No resource found that matches the given name。
- Android问题-No resource found that matches the given name (at 'theme' with value '@style/CaptureTheme').
- Android 创建项目出现No resource found that matches the given name Theme.AppCompat.Light
- No resource found that matches the given name (at 'drawab' with value '@drawable/你的资源').
- Android开发问题笔记(一):No resource found that matches the given name 'Theme.AppCompat.Light'.
- Android布局问题: No resource found that matches the given name (at 'layout_above' with value @id/tv)
- 关于安卓出现No resource found that matches the given name 'Theme.AppCompat.Light 的完美解决方案
- android studio 出现错误 No resource found that matches the given name...
- appcompat-v7 版本造成的问题No resource found that matches the given name 'android:TextAppearance.Material.W
- error: Error retrieving parent for item: No resource found that matches the given name 'android:Wind
- No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/tx_search_friend
- 解决No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'
- No resource found that matches the given name: attr 'android:keyboardNavigationCluster'
- error: Error: No resource found that matches the given name: attr 'actionBarTabStyle'.