AAPT: error: style attribute attr/itemBackground after importing AAR to Flutter

188 Views Asked by At

I have an aar file which has to be imported into Flutter project. But when I imported into project, it requires lots of style files which I don't have any clue what to do at this point.

Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml:1593: AAPT: error: style attribute 'attr/itemBackground (aka com.example.project:attr/itemBackground)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml:1594: AAPT: error: style attribute 'attr/itemIconTint (aka com.example.project:attr/itemIconTint)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml:1595: AAPT: error: style attribute 'attr/itemTextColor (aka com.example.project:attr/itemTextColor)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml:2030: AAPT: error: style attribute 'attr/colorPrimaryVariant (aka com.example.project:attr/colorPrimaryVariant)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml:2031: AAPT: error: style attribute 'attr/colorOnPrimary (aka com.example.project:attr/colorOnPrimary)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml:2033: AAPT: error: style attribute 'attr/colorSecondary (aka com.example.project:attr/colorSecondary)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml:2034: AAPT: error: style attribute 'attr/colorSecondaryVariant (aka com.example.project:attr/colorSecondaryVariant)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml:2035: AAPT: error: style attribute 'attr/colorOnSecondary (aka com.example.project:attr/colorOnSecondary)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values-night-v8/values-night-v8.xml:40: AAPT: error: style attribute 'attr/colorPrimaryVariant (aka com.example.project:attr/colorPrimaryVariant)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values-night-v8/values-night-v8.xml:41: AAPT: error: style attribute 'attr/colorOnPrimary (aka com.example.project:attr/colorOnPrimary)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values-night-v8/values-night-v8.xml:43: AAPT: error: style attribute 'attr/colorSecondary (aka com.example.project:attr/colorSecondary)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values-night-v8/values-night-v8.xml:44: AAPT: error: style attribute 'attr/colorSecondaryVariant (aka com.example.project:attr/colorSecondaryVariant)' not found.

     ERROR:/Users/user/Projects/Project/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values-night-v8/values-night-v8.xml:45: AAPT: error: style attribute 'attr/colorOnSecondary (aka com.example.project:attr/colorOnSecondary)' not found.

I have implemented some styles but still I'm unable to run the project.

Here is some implementations in values/styles.xml and values-night-v8/style.xml

   <style name="NormalTheme" parent="@android:style/Theme.Light.NoActionBar">
        <item name="android:windowBackground">?android:colorBackground</item>
        <item type = "attr" name="colorPrimary">#FFFFFFFF</item>
        <item type = "attr" name= "itemIconTint">#FFFFFFFF</item>
        <item type = "attr" name= "itemTextColor">#FFFFFFFF</item>
        <item type = "attr" name= "itemBackground">#FFFFFFFF</item> 
    </style>

How can I solve the problem?

1

There are 1 best solutions below

3
Waqar Afzal On

It is most likely Due to old material lib version, update all UI library and compatibility support to 17