java - 我怎样才能避免运行我的第一个 Android 应用程序时发生的错误?

标签 java android

我在 eclipse 中的真实设备上运行我的第一个应用程序时遇到错误。我在我的设备上启用了 USB 调试并在 eclipse 中按下“RUN AS”然后我得到了 7 个错误

Description Resource    Path    Location    Type
Invalid layout param in a LinearLayout: layout_alignParentTop   abc_action_bar_decor_overlay.xml    /appcompat_v7/res/layout    line 32 Android Lint Problem
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"    abc_action_bar_decor_overlay.xml    /appcompat_v7/res/layout    line 25 Android Lint Problem
The following unrelated icon files have identical contents: abc_textfield_search_selected_holo_dark.9.png, abc_textfield_search_selected_holo_light.9.png   abc_textfield_search_selected_holo_light.9.png  /appcompat_v7/res/drawable-mdpi line 1  Android Lint Problem
The resource R.dimen.abc_search_view_preferred_width appears to be unused   dimens.xml  /appcompat_v7/res/values    line 53 Android Lint Problem
The resource R.bool.abc_action_bar_expanded_action_views_exclusive appears to be unused bools.xml   /appcompat_v7/res/values    line 19 Android Lint Problem
The resource R.integer.abc_max_action_buttons appears to be unused  dimens.xml  /appcompat_v7/res/values    line 22 Android Lint Problem
The following unrelated icon files have identical contents: abc_list_pressed_holo_dark.9.png, abc_list_pressed_holo_light.9.png abc_list_pressed_holo_light.9.png   /appcompat_v7/res/drawable-hdpi line 1  Android Lint Problem
The resource R.bool.abc_action_bar_embed_tabs_pre_jb appears to be unused   bools.xml   /appcompat_v7/res/values    line 18 Android Lint Problem
The resource R.dimen.abc_action_bar_stacked_tab_max_width appears to be unused  dimens.xml  /appcompat_v7/res/values    line 27 Android Lint Problem
The resource R.layout.abc_action_bar_tab appears to be unused   abc_action_bar_tab.xml  /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.dimen.abc_action_bar_stacked_max_height appears to be unused dimens.xml  /appcompat_v7/res/values    line 44 Android Lint Problem
Nested weights are bad for performance  abc_search_view.xml /appcompat_v7/res/layout    line 90 Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_search_view.xml /appcompat_v7/res/layout    line 64 Android Lint Problem
Use a layout_width of 0dip instead of wrap_content for better performance   abc_search_view.xml /appcompat_v7/res/layout    line 78 Android Lint Problem
The resource R.layout.abc_list_menu_item_icon appears to be unused  abc_list_menu_item_icon.xml /appcompat_v7/res/layout    line 1  Android Lint Problem
The abc_list_divider_holo_dark.9.png icon has identical contents in the following configuration folders: drawable-hdpi, drawable-mdpi   abc_list_divider_holo_dark.9.png    /appcompat_v7/res/drawable-mdpi line 1  Android Lint Problem
Nested weights are bad for performance  abc_search_view.xml /appcompat_v7/res/layout    line 80 Android Lint Problem
Attribute is missing the Android namespace prefix   abc_search_dropdown_dark.xml    /appcompat_v7/res/drawable  line 19 Android Lint Problem
The resource R.anim.abc_fade_out appears to be unused   abc_fade_out.xml    /appcompat_v7/res/anim  line 1  Android Lint Problem
The resource R.layout.abc_action_bar_view_list_nav_layout appears to be unused  abc_action_bar_view_list_nav_layout.xml /appcompat_v7/res/layout    line 1  Android Lint Problem
Use a layout_width of 0dip instead of wrap_content for better performance   abc_search_view.xml /appcompat_v7/res/layout    line 54 Android Lint Problem
The resource R.layout.abc_action_bar_decor appears to be unused abc_action_bar_decor.xml    /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.anim.abc_slide_out_top appears to be unused  abc_slide_out_top.xml   /appcompat_v7/res/anim  line 1  Android Lint Problem
The resource R.layout.abc_action_menu_layout appears to be unused   abc_action_menu_layout.xml  /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.anim.abc_slide_in_bottom appears to be unused    abc_slide_in_bottom.xml /appcompat_v7/res/anim  line 1  Android Lint Problem
The resource R.layout.abc_action_mode_bar appears to be unused  abc_action_mode_bar.xml /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.layout.abc_action_bar_title_item appears to be unused    abc_action_bar_title_item.xml   /appcompat_v7/res/layout    line 1  Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_action_bar_title_item.xml   /appcompat_v7/res/layout    line 25 Android Lint Problem
The following unrelated icon files have identical contents: abc_textfield_search_right_selected_holo_dark.9.png, abc_textfield_search_right_selected_holo_light.9.png   abc_textfield_search_right_selected_holo_light.9.png    /appcompat_v7/res/drawable-xhdpi    line 1  Android Lint Problem
The resource R.layout.abc_expanded_menu_layout appears to be unused abc_expanded_menu_layout.xml    /appcompat_v7/res/layout    line 1  Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_activity_chooser_view_include.xml   /appcompat_v7/res/layout    line 54 Android Lint Problem
Duplicate id @+id/image, already defined earlier in this layout abc_activity_chooser_view_include.xml   /appcompat_v7/res/layout    line 55 Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_activity_chooser_view_include.xml   /appcompat_v7/res/layout    line 31 Android Lint Problem
"action_settings" is not translated in af, am, ar, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms-rMY, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu   strings.xml /MyFirstApp/res/values  line 5  Android Lint Problem
The following unrelated icon files have identical contents: abc_textfield_search_right_selected_holo_dark.9.png, abc_textfield_search_right_selected_holo_light.9.png   abc_textfield_search_right_selected_holo_light.9.png    /appcompat_v7/res/drawable-mdpi line 1  Android Lint Problem
"app_name" is not translated in af, am, ar, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms-rMY, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu  strings.xml /MyFirstApp/res/values  line 4  Android Lint Problem
"hello_world" is not translated in af, am, ar, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms-rMY, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu   strings.xml /MyFirstApp/res/values  line 6  Android Lint Problem
Attribute is missing the Android namespace prefix   abc_search_dropdown_light.xml   /appcompat_v7/res/drawable  line 19 Android Lint Problem
This tag and its children can be replaced by one <TextView/> and a compound drawable    abc_activity_chooser_view_list_item.xml /appcompat_v7/res/layout    line 26 Android Lint Problem
This LinearLayout layout or its LinearLayout parent is useless  abc_activity_chooser_view_list_item.xml /appcompat_v7/res/layout    line 26 Android Lint Problem
The resource R.layout.abc_popup_menu_item_layout appears to be unused   abc_popup_menu_item_layout.xml  /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.layout.abc_activity_chooser_view_list_item appears to be unused  abc_activity_chooser_view_list_item.xml /appcompat_v7/res/layout    line 1  Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_activity_chooser_view_list_item.xml /appcompat_v7/res/layout    line 31 Android Lint Problem
The resource R.layout.abc_activity_chooser_view appears to be unused    abc_activity_chooser_view.xml   /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.layout.abc_search_dropdown_item_icons_2line appears to be unused abc_search_dropdown_item_icons_2line.xml    /appcompat_v7/res/layout    line 1  Android Lint Problem
The following unrelated icon files have identical contents: abc_list_pressed_holo_dark.9.png, abc_list_pressed_holo_light.9.png abc_list_pressed_holo_light.9.png   /appcompat_v7/res/drawable-xhdpi    line 1  Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_action_mode_close_item.xml  /appcompat_v7/res/layout    line 27 Android Lint Problem
The resource R.layout.abc_action_mode_close_item appears to be unused   abc_action_mode_close_item.xml  /appcompat_v7/res/layout    line 1  Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_search_dropdown_item_icons_2line.xml    /appcompat_v7/res/layout    line 49 Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_search_dropdown_item_icons_2line.xml    /appcompat_v7/res/layout    line 29 Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_search_dropdown_item_icons_2line.xml    /appcompat_v7/res/layout    line 38 Android Lint Problem
The resource R.layout.abc_action_bar_decor_overlay appears to be unused abc_action_bar_decor_overlay.xml    /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.layout.abc_search_view appears to be unused  abc_search_view.xml /appcompat_v7/res/layout    line 1  Android Lint Problem
The following unrelated icon files have identical contents: abc_list_pressed_holo_dark.9.png, abc_list_pressed_holo_light.9.png abc_list_pressed_holo_light.9.png   /appcompat_v7/res/drawable-mdpi line 1  Android Lint Problem
Possible overdraw: Root element paints background ?attr/actionBarItemBackground with a theme that also paints a background (inferred theme is @style/AppTheme)  abc_action_bar_home.xml /appcompat_v7/res/layout    line 21 Android Lint Problem
The resource R.dimen.abc_config_prefDialogWidth appears to be unused    config.xml  /appcompat_v7/res/values    line 28 Android Lint Problem
The resource R.layout.abc_list_menu_item_checkbox appears to be unused  abc_list_menu_item_checkbox.xml /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.anim.abc_slide_out_bottom appears to be unused   abc_slide_out_bottom.xml    /appcompat_v7/res/anim  line 1  Android Lint Problem
The resource R.layout.support_simple_spinner_dropdown_item appears to be unused support_simple_spinner_dropdown_item.xml    /appcompat_v7/res/layout    line 1  Android Lint Problem
The abc_list_divider_holo_light.9.png icon has identical contents in the following configuration folders: drawable-hdpi, drawable-mdpi  abc_list_divider_holo_light.9.png   /appcompat_v7/res/drawable-mdpi line 1  Android Lint Problem
The resource R.bool.abc_config_allowActionMenuItemTextWithIcon appears to be unused config.xml  /appcompat_v7/res/values    line 23 Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_list_menu_item_icon.xml /appcompat_v7/res/layout    line 17 Android Lint Problem
The resource R.layout.abc_list_menu_item_radio appears to be unused abc_list_menu_item_radio.xml    /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.layout.abc_action_menu_item_layout appears to be unused  abc_action_menu_item_layout.xml /appcompat_v7/res/layout    line 1  Android Lint Problem
The resource R.layout.abc_list_menu_item_layout appears to be unused    abc_list_menu_item_layout.xml   /appcompat_v7/res/layout    line 1  Android Lint Problem
This class should be public (android.support.v7.internal.widget.ActionBarView.HomeView) MyFirstApp      line 1  Android Lint Problem
The resource R.anim.abc_fade_in appears to be unused    abc_fade_in.xml /appcompat_v7/res/anim  line 1  Android Lint Problem
The resource R.string.abc_shareactionprovider_share_with appears to be unused   strings.xml /appcompat_v7/res/values    line 46 Android Lint Problem
The resource R.string.abc_activitychooserview_choose_application appears to be unused   strings.xml /appcompat_v7/res/values    line 40 Android Lint Problem
Missing the following drawables in drawable-xhdpi: abc_ic_clear_normal.png (found in drawable-hdpi, drawable-mdpi)  MyFirstApp      line 1  Android Lint Problem
The resource R.anim.abc_slide_in_top appears to be unused   abc_slide_in_top.xml    /appcompat_v7/res/anim  line 1  Android Lint Problem
The resource R.string.abc_shareactionprovider_share_with_application appears to be unused   strings.xml /appcompat_v7/res/values    line 44 Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_action_bar_decor_overlay.xml    /appcompat_v7/res/layout    line 47 Android Lint Problem
The resource R.bool.abc_config_showMenuShortcutsWhenKeyboardPresent appears to be unused    bools.xml   /appcompat_v7/res/values    line 22 Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_action_bar_home.xml /appcompat_v7/res/layout    line 22 Android Lint Problem
The resource R.bool.abc_split_action_bar_is_narrow appears to be unused bools.xml   /appcompat_v7/res/values    line 20 Android Lint Problem
The resource R.layout.abc_action_bar_tabbar appears to be unused    abc_action_bar_tabbar.xml   /appcompat_v7/res/layout    line 1  Android Lint Problem
[Accessibility] Missing contentDescription attribute on image   abc_action_bar_home.xml /appcompat_v7/res/layout    line 29 Android Lint Problem
The resource R.string.abc_action_bar_up_description appears to be unused    strings.xml /appcompat_v7/res/values    line 23 Android Lint Problem
The resource R.string.abc_action_bar_home_description appears to be unused  strings.xml /appcompat_v7/res/values    line 21 Android Lint Problem
The resource R.string.abc_activity_chooser_view_see_all appears to be unused    strings.xml /appcompat_v7/res/values    line 42 Android Lint Problem
The resource R.string.abc_action_menu_overflow_description appears to be unused strings.xml /appcompat_v7/res/values    line 25 Android Lint Problem

最佳答案

此处的大部分错误来自 Lint .. 他们不会破坏应用程序,但这些是您应该在发布前更正的错误。如果您想在出现这些错误的情况下运行应用程序,请暂时关闭项目的 Lint 检查,但不要忘记修复这些问题。清理项目将删除报告的 Lint 错误。

关于java - 我怎样才能避免运行我的第一个 Android 应用程序时发生的错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22280434/

相关文章:

android - 为 CheckboxPreference 设置字体

java - 最小化 GWT 应用程序的编译大小

java - 在Java中获取给定范围之间的随机数

android - Unresolved reference : isInitialized on lateinit property

java - 在单独的类中加载 JSON 数组列表并在另一个 Activity 中加载

android - 在android中的对话框内创建动态按钮

java - 极小极大问题——连接四个。

java - wsdl 属性动态变化

java - Spring JMS 无法连接到 JBoss EAP 7.1 ActiveMq Artemis

android - 如何将我的布局拆分为 3 个不同的滑动 View