Android开发常见问题之"Failed to convert @drawable/xx into a drawable Exception details are logged in Window
2017-05-21 19:12
483 查看
问题描述
图片资源引用错误,通常会有如下类似的错误日志:java.lang.NumberFormatException: Color value '@drawable/xx' must start with #
原因
出现这个问题,最大的可能是你的图片资源命名出错,而且很可能是以数字开头。在Android里面,如果你的图片是以数字开头命名的,系统会默认把它当成一个16进制的color value,而这些color value的定义往往是以”#”开头的,所以才会有下面的NumberFormatException。解决方案
此时,你需要检查出错的资源命名是不是以数字开头的,如果是以数字开头的,重命名一下;如果不是,eclipse下试着检查一下资源的命名是不是以空格开头的(当然此时的错误是找不到drawable文件),如果是,修改之;如果不是,可以将图片删除,重新添加一下。重名命名之后,如果layout文件还不能正常显示,刷新一下layout视图预览或者重启一下开发工具就可以了。
相关文章推荐
- 【Android】Failed to convert @drawable/picture into a drawable
- Android: failed to convert @drawable/picture into a drawable
- [Nutch]问题解决:Exception in thread "main" java.io.IOException: Failed to set permissions of path
- Exception details are logged in Window > Show View > Error Log
- Android开发中的代码关联问题:Failed to create the part'sControls(Unmatched braces in the pattern.)
- java.lang.NullPointerException Exception details are logged in Window > Show View > Error Log 正确解决方法
- Android: Failed to convert @drawable/picture into a drawable
- [Android开发常见问题-14] Unexpected namespace prefix "abc" found for tag SomeThing
- hive 终端产生的问题 (Failed to start database 'metastore_db', see the next exception for details.)
- [Android开发常见问题-18] Connection to https://dl-ssl.google.com refused
- [Android开发常见问题-11] Unable to execute dex: Multiple dex files define 解决方法
- [Android开发常见问题-18] Connection to https://dl-ssl.google.com refused
- Exception in thread "main" java.io.IOException: Failed to set permissions of path
- Android开发-Failed to convert path to a short DOS path: C:\Windows\system32\java.exe
- hive 终端产生的问题 (Failed to start database 'metastore_db', see the next exception for details.)
- android工程常见问题处理之Unable to resolve target 'android-xx'
- android 工程开发问题Failed java.util.EmptyStackException
- (转)Ubuntu 64 位下Android开发出现Error : Failed to create sdcard in the AVD folder
- [Android] "Failed to find Java version for 'C:\Windows\system32\java.exe"问题的解决方法
- 安装VisualSVN时遇到的问题-Service ‘VisualSVN Server’ failed to start. Please check VisualSVN Server log in Event Viewer for more details.