今晚看到慕课网推荐的一篇文章(http://www.imooc.com/wenda/detail/245965),讲的是使用Android lint工具进行Android代码优化。看完我便自己尝试了一下,没想到整个workspace下多个工程都出现了错误,无法运行了。
其中我遇到的错误有如下几种:
1,Description Path Resource Location Type
“app_name” is not translated in “af” (Afrikaans), “am” (Amharic), “ar” (Arabic), “bg” (Bulgarian), “ca” (Catalan), “cs” (Czech), “da” (Danish), “de” (German), “el” (Greek), “en-rGB” (English: United Kingdom), “en-rIN” (English: India), “es” (Spanish), “es-rUS” (Spanish: United States), “et-rEE” (Estonian: Estonia), “fa” (Persian), “fi” (Finnish), “fr” (French), “fr-rCA” (French: Canada), “hi” (Hindi), “hr” (Croatian), “hu” (Hungarian), “hy-rAM” (Armenian: Armenia), “in” (Indonesian), “it” (Italian), “iw” (Hebrew), “ja” (Japanese), “ka-rGE” (Georgian: Georgia), “km-rKH” (Khmer: Cambodia), “ko” (Korean), “lo-rLA” (Lao: Lao People’s Democratic Republic), “lt” (Lithuanian), “lv” (Latvian), “mn-rMN” (Mongolian: Mongolia), “ms-rMY” (Malay: Malaysia), “nb” (Norwegian Bokmål), “nl” (Dutch), “pl” (Polish), “pt” (Portuguese), “pt-rPT” (Portuguese: Portugal), “ro” (Romanian), “ru” (Russian), “sk” (Slovak), “sl” (Slovene), “sr” (Serbian), “sv” (Swedish), “sw” (Swahili), “th” (Thai), “tl” (Tagalog), “tr” (Turkish), “uk” (Ukrainian), “vi” (Vietnamese), “zh-rCN” (Chinese: China), “zh-rHK” (Chinese: Hong Kong), “zh-rTW” (Chinese: Taiwan, Province of China), “zu” (Zulu) /Demo_AutoChat/res/values strings.xml line 4 Android Lint Problem
2,Description Path Resource Location Type
Duplicate id @+id/image, already defined earlier in this layout /appcompat_v7/res/layout abc_activity_chooser_view_include.xml line 55 Android Lint Problem
3,Description Path Resource Location Type
Attribute is missing the Android namespace prefix /appcompat_v7/res/drawable abc_search_dropdown_dark.xml line 19 Android Lint Problem
4,Description Path Resource Location Type
This class should be public (android.support.v7.internal.widget.ActionBarView.HomeView) Demo_AutoChat line 1 Android Lint Problem
5,Description Path Resource Location Type
Wrong orientation? No orientation specified, and the default is horizontal, yet this layout has multiple children where at least one has layout_width=”match_parent” /appcompat_v7/res/layout abc_action_bar_decor_overlay.xml line 25 Android Lint Problem
解决方法:
1,这个应该为未进行多语言适配错误。解决方法:右击左侧栏项目名称,在弹出菜单中选最后一项”Properties”打开。在下面页面中选择 “Android Lint Preference”,然后将 “MissingTranslation” 从 “fatal” 改为 “warning“或“warning“以下的选项。
2-5,这几个错误都指向appcompat_v7这个Eclipse自动生成的工程,我也没办法修改错误,百度也没有对应的解决方法,最后我就无意尝试到解决方法:把appcompat_v7从工作环境中删除(注意不要把源文件删了),再重新导入工作环境,然后问题就解决了。
感悟:
Android lint我是第一次接触,看了很多大牛说很有用,所以会去好好学,但是第一次用就遇到了问题,把程序都搞不能运行了,也是蛮紧张的。