简体   繁体   中英

Android Resource Linking Failed values, styles.xml

So i want to create a new android project then suddenly i have this error saying Android Resource Linking Failed and below here is my code.

Styles.xml

resources>

    <!-- Base application theme. -->
    <style type ="attr" name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item type="attr" name="colorPrimary">@color/colorPrimary</item>
        <item type="attr" name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item type="attr" name="colorAccent">@color/colorAccent</item>
    </style>

</resources>

Error Shown

C:\Users\ASUS\Desktop\Rapih\Re_Mind\app\src\main\res\values\styles.xml:4:5-9:13: AAPT: error: style attribute 'attr/colorPrimary (aka app.com.re_mind:attr/colorPrimary)' not found.

Use something like this do not add type attribute. this might help you.

 <style name="AppTheme" parent="Base.Theme.MaterialComponents.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM