Android Studio 3.2错误资源链接失败的Style.xml问题

时间:2018-10-10 15:03:31

标签: android gradle resources styles

这是输出错误,大多数错误与我的/ values-> /style.xml链接 我无法弄清楚该如何解决此错误,我已经卸载了android studio并再次下载了该错误,但该错误会自我帮助!需要!

Output:  warn: removing resource com.example.ahsan.tree:string/abc_action_bar_home_description without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_action_bar_up_description without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_action_menu_overflow_description without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_action_mode_done without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_activity_chooser_view_see_all without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_activitychooserview_choose_application without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_capital_off without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_capital_on without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_alt_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_ctrl_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_delete_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_enter_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_function_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_meta_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_shift_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_space_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_menu_sym_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_prepend_shortcut_label without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_search_hint without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_searchview_description_clear without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_searchview_description_query without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_searchview_description_search without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_searchview_description_submit without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_searchview_description_voice without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_shareactionprovider_share_with without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_shareactionprovider_share_with_application without required default value.
warn: removing resource com.example.ahsan.tree:string/abc_toolbar_collapse_description without required default value.
warn: removing resource com.example.ahsan.tree:string/search_menu_title without required default value.
warn: removing resource com.example.ahsan.tree:string/status_bar_notification_info_overflow without required default value.
error: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.example.ahsan.tree:style/Theme.AppCompat.Light.DarkActionBar) not found.

这些是用于大多数为style.xml的错误的命令

    C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:9: error: style attribute 'attr/colorPrimary (aka com.example.ahsan.tree:attr/colorPrimary)' not found.
C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:10: error: style attribute 'attr/colorPrimaryDark (aka com.example.ahsan.tree:attr/colorPrimaryDark)' not found.
C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:11: error: style attribute 'attr/colorAccent (aka com.example.ahsan.tree:attr/colorAccent)' not found.
error: resource style/Base.Theme.AppCompat.Dialog.FixedSize (aka com.example.ahsan.tree:style/Base.Theme.AppCompat.Dialog.FixedSize) not found.
error: resource style/Base.Theme.AppCompat.Light.Dialog.FixedSize (aka com.example.ahsan.tree:style/Base.Theme.AppCompat.Light.Dialog.FixedSize) not found.
error: resource style/Base.Widget.AppCompat.DrawerArrowToggle.Common (aka com.example.ahsan.tree:style/Base.Widget.AppCompat.DrawerArrowToggle.Common) not found.
C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-hdpi-v4\values-hdpi-v4.xml:4: error: style attribute 'attr/barLength (aka com.example.ahsan.tree:attr/barLength)' not found.
C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-hdpi-v4\values-hdpi-v4.xml:5: error: style attribute 'attr/gapBetweenBars (aka com.example.ahsan.tree:attr/gapBetweenBars)' not found.
C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-hdpi-v4\values-hdpi-v4.xml:6: error: style attribute 'attr/drawableSize (aka com.example.ahsan.tree:attr/drawableSize)' not found.
error: resource style/Theme.AppCompat (aka com.example.ahsan.tree:style/Theme.AppCompat) not found.
error: resource style/Theme.AppCompat (aka com.example.ahsan.tree:style/Theme.AppCompat) not found.
error: resource style/Theme.AppCompat.Dialog (aka com.example.ahsan.tree:style/Theme.AppCompat.Dialog) not found.
error: resource style/Theme.AppCompat.Dialog.Alert (aka com.example.ahsan.tree:style/Theme.AppCompat.Dialog.Alert) not found.
error: resource style/Theme.AppCompat.Dialog.MinWidth (aka com.example.ahsan.tree:style/Theme.AppCompat.Dialog.MinWidth) not found.
error: resource style/Theme.AppCompat.DialogWhenLarge (aka com.example.ahsan.tree:style/Theme.AppCompat.DialogWhenLarge) not found.
error: resource style/Theme.AppCompat.NoActionBar (aka com.example.ahsan.tree:style/Theme.AppCompat.NoActionBar) not found.
error: failed linking references.

Command: C:\Users\Ahsan\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\fff13b5cf61430cfb7ed93349534cd31\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
        C:\Users\Ahsan\AppData\Local\Android\Sdk\platforms\android-28\android.jar\
        --manifest\

        C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
        -o\
        C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
        -R\
        @C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
        --auto-add-overlay\
        --java\
        C:\Users\Ahsan\AndroidStudioProjects\tree\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
        --custom-package\
        com.example.ahsan.tree\
        -0\
        apk\
        --no-version-vectors

这是守护程序错误

Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

图片

Style.xml image of error code

Build.gradle (Module:app) image

Build.gradle (Project:app_name) image

Main Activity Image

4 个答案:

答案 0 :(得分:2)

最近我遇到了这个问题。我所做的错误是如下两次错误地将xml标头放置两次:

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="100dp" />
    <solid android:color="#41ba7a" />
    <stroke
        android:width="3dip"
        android:color="#f9f9f9" />
    <padding
        android:bottom="4dp"
        android:left="4dp"
        android:right="4dp"
        android:top="4dp" />
</shape>

希望对您有帮助。

答案 1 :(得分:0)

您没有导入R导入。也许是导致问题的原因。

将鼠标置于MainActivity中,这将建议添加R导入,使用 ALT + Enter 并导入{{1 }}。

然后从R重建项目。

答案 2 :(得分:0)

请按照此操作;

文件->项目结构->应用程序(在模块内部)->依赖关系-单击“ +”->库依赖关系->搜索“ appcompat”,然后单击“ com.android.support:appcompat- v7(com.android.support:appcompat-v7:27.1.1)”->单击“确定”。

这应该可以解决您的错误!

检查此链接。您可以在1:35看到。 https://www.youtube.com/watch?v=VRLfzi5bdJs

答案 3 :(得分:0)

更改compileSdkVersion> 28