Android Error:Aapt2Exception: AAPT2 error: check logs for details

Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

error: invalid parent reference 'style/TextAppearance.AppCompat.Widget.ActionBar.Title'.
Message{kind=ERROR, text=error: invalid parent reference 'style/TextAppearance.AppCompat.Widget.ActionBar.Title'., sources=[/home/espl/A_temp_proj_hack/DemoApp/app/src/main/res/values/styles.xml:204:5-207:13], original message=, tool name=Optional.of(AAPT)}
Below is the code in my AndroidManifest.xml file where i found error related to style tag for parent parameter.
 <style name="MyActionBar.MenuTextStyle" parent="style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/white</item>
        <item name="android:textSize">15sp</item>
    </style>

Replace the style tag with @style in AndroidManifest.xml.
after change::
 <style name="MyActionBar.MenuTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/white</item>
        <item name="android:textSize">15sp</item>
    </style>
I come accross this error of mispalced intent-filter tag outside the activty while updating gradle plugin from(2.2.3) to latest android plugin(3.1.4). Intent-filter tag decleration outside of the activity or service tag causes "error: unknown element <intent-filter> found."
Message{kind=ERROR, text=error: unknown element <intent-filter> found., sources=[/home/espl/A_temp_proj_hack/DemoApp/app/build/intermediates/manifests/full/release/AndroidManifest.xml:180], original message=, tool name=Optional.of(AAPT)}
So to remove such error either comment the whole tag or place it inside corresponding activity/service tag decleration. AAPT2 doen't allows misplaced tags.

Some similar AAPT2 errors related to manifest and resource file are listed below:
AndroidManifest.xml:15: error: unknown element <action> found.

Error: style attribute 'attr/attr/my_attr (aka my.package:attr/attr/my_attr)'
not found.

Error: (...) invalid resource type 'attr' for parent of style
Previous versions of AAPT would simply ignore the misplaced tag. However, with new AAPT (AAPT2) now throws an error on this due to Behavior changes when using AAPT2

For more read this: Android Studio 3.0 Manifest Error: unknown element <action> found

No comments:

Post a Comment

Popular Posts