ohmae/preference-activity-compat

Update to Android Studio 3.6 breaks build

1951FDG opened this issue · 2 comments

Android resource linking failed:
~/.gradle/caches/transforms-2/files-2.1/3e64374fa330967ee9aafd7d69d23b2c/jetified-preference-0.2.2/res/values/values.xml:24:5-32:25: AAPT: error: resource attr/id not found.

Temporary workaround:
Add <attr name="id" /> to attrs.xml

I think this is related to the change in AAPT2 where it became stricter about defining attr resources in styleables. Before you could define a new attribute under a declare styleable without giving its format, and now you have to explicitly define it as its own resource (if I understood correctly).

This change in aapt2 was made because aapt(1) also required that one either explicitly defines the attribute separately (with or without a format) or one specifies the format on the attribute within the declare-styleable.

aapt2 did not require this at first and allowed for declare-styleable attributes defined without a format to create new attribute resources.

The reason why these errors show in 3.6 and not in 3.5 is that AAPT2 fixed a bug that allowed defining attributes without format under declare styleables, which would result in missing attr format at runtime. Now we're back to being strict about it, and fail early to let the developers know about these problems. So for AGP and AAPT2 this is working as intended.

This is the relevant issue in the Google tracker https://issuetracker.google.com/issues/136103084

ohmae commented

Thank you for report me. I fixed it and release 0.2.3

Wow that was fast, thank you!